mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
refactor: move Platform
This commit is contained in:
@@ -125,6 +125,7 @@
|
||||
<ClInclude Include="Utils\AsstRanges.hpp" />
|
||||
<ClInclude Include="Utils\AsstTypes.h" />
|
||||
<ClInclude Include="Utils\AsstUtils.hpp" />
|
||||
<ClInclude Include="Utils\Platform.hpp" />
|
||||
<ClInclude Include="Utils\Locale.hpp" />
|
||||
<ClInclude Include="Utils\Demangle.hpp" />
|
||||
<ClInclude Include="Utils\Meta.hpp" />
|
||||
|
||||
@@ -617,6 +617,9 @@
|
||||
<ClInclude Include="Utils\AsstHttp.hpp">
|
||||
<Filter>源文件\Utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utils\Platform.hpp">
|
||||
<Filter>源文件\Utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utils\AsstImageIo.hpp">
|
||||
<Filter>源文件\Utils</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -49,31 +49,4 @@ namespace asst::utils
|
||||
#endif // END _WIN32
|
||||
return buff;
|
||||
}
|
||||
|
||||
using os_string = platform::os_string;
|
||||
|
||||
#ifdef _WIN32
|
||||
static_assert(std::same_as<os_string, std::wstring>);
|
||||
#else
|
||||
static_assert(std::same_as<os_string, std::string>);
|
||||
#endif
|
||||
|
||||
using platform::from_osstring;
|
||||
using platform::path;
|
||||
using platform::path_to_ansi_string;
|
||||
using platform::path_to_crt_string;
|
||||
using platform::path_to_utf8_string;
|
||||
using platform::to_osstring;
|
||||
|
||||
using platform::callcmd;
|
||||
|
||||
namespace path_literals
|
||||
{
|
||||
inline std::filesystem::path operator"" _p(const char* utf8_str, size_t len)
|
||||
{
|
||||
// 日后再优化(
|
||||
return asst::utils::path(std::string(std::string_view(utf8_str, len)));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace asst::utils
|
||||
|
||||
33
src/MeoAssistant/Utils/Platform.hpp
Normal file
33
src/MeoAssistant/Utils/Platform.hpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include "Platform/AsstPlatform.h"
|
||||
|
||||
namespace asst::utils
|
||||
{
|
||||
using os_string = platform::os_string;
|
||||
|
||||
#ifdef _WIN32
|
||||
static_assert(std::same_as<os_string, std::wstring>);
|
||||
#else
|
||||
static_assert(std::same_as<os_string, std::string>);
|
||||
#endif
|
||||
|
||||
using platform::from_osstring;
|
||||
using platform::path;
|
||||
using platform::path_to_ansi_string;
|
||||
using platform::path_to_crt_string;
|
||||
using platform::path_to_utf8_string;
|
||||
using platform::to_osstring;
|
||||
|
||||
using platform::callcmd;
|
||||
|
||||
namespace path_literals
|
||||
{
|
||||
inline std::filesystem::path operator"" _p(const char* utf8_str, size_t len)
|
||||
{
|
||||
// 日后再优化(
|
||||
return asst::utils::path(std::string(std::string_view(utf8_str, len)));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace asst::utils
|
||||
Reference in New Issue
Block a user