diff options
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/pch.h | 9 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/files.h | 31 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/system.process.h | 2 |
3 files changed, 31 insertions, 11 deletions
diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index f92792411..c8ca1ea7c 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -2,6 +2,7 @@ #include <vcpkg/base/system_headers.h> +#include <vcpkg/base/files.h> #include <vcpkg/base/pragmas.h> #if defined(_WIN32) @@ -23,14 +24,6 @@ #include <cctype> #include <chrono> #include <codecvt> - -#if VCPKG_USE_STD_FILESYSTEM -#include <filesystem> -#else -#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING -#include <experimental/filesystem> -#endif - #include <fstream> #include <functional> #include <iomanip> diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index a202bfdef..e0a555024 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -2,11 +2,17 @@ #include <vcpkg/base/expected.h> #include <vcpkg/base/ignore_errors.h> +#include <vcpkg/base/pragmas.h> + +#include <string.h> + +#if !defined(VCPKG_USE_STD_FILESYSTEM) +#error The build system must set VCPKG_USE_STD_FILESYSTEM. +#endif // !defined(VCPKG_USE_STD_FILESYSTEM) #if VCPKG_USE_STD_FILESYSTEM #include <filesystem> #else -#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING #include <experimental/filesystem> #endif @@ -22,7 +28,28 @@ namespace fs using stdfs::directory_iterator; using stdfs::path; using stdfs::perms; - using stdfs::u8path; + + path u8path(vcpkg::StringView s); + inline path u8path(const char* first, const char* last) { return u8path(vcpkg::StringView{first, last}); } + inline path u8path(const char* s) { return u8path(vcpkg::StringView{s, s + ::strlen(s)}); } + +#if defined(_MSC_VER) + inline path u8path(std::string::const_iterator first, std::string::const_iterator last) + { + if (first == last) + { + return path{}; + } + else + { + auto firstp = &*first; + return u8path(vcpkg::StringView{firstp, firstp + (last - first)}); + } + } +#endif + + std::string u8string(const path& p); + std::string generic_u8string(const path& p); #if defined(_WIN32) enum class file_type diff --git a/toolsrc/include/vcpkg/base/system.process.h b/toolsrc/include/vcpkg/base/system.process.h index b9184c05c..4bbcba717 100644 --- a/toolsrc/include/vcpkg/base/system.process.h +++ b/toolsrc/include/vcpkg/base/system.process.h @@ -25,7 +25,7 @@ namespace vcpkg::System struct CmdLineBuilder { - CmdLineBuilder& path_arg(const fs::path& p) { return string_arg(p.u8string()); } + CmdLineBuilder& path_arg(const fs::path& p) { return string_arg(fs::u8string(p)); } CmdLineBuilder& string_arg(StringView s); CmdLineBuilder& ampersand() { |
