diff options
| -rw-r--r-- | toolsrc/include/vcpkg/base/files.h | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/files.cpp | 5 |
2 files changed, 7 insertions, 11 deletions
diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index 69ec41fe3..e1628eaf0 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -48,20 +48,11 @@ namespace fs inline path u8path(std::initializer_list<char> il) { return u8path(vcpkg::StringView{il.begin(), il.end()}); } 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)}); - } + 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); diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index ce68741d5..afd30bf85 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -104,6 +104,11 @@ namespace fs::path fs::u8path(vcpkg::StringView s) { + if (s.size() == 0) + { + return fs::path(); + } + #if defined(_WIN32) return fs::path(vcpkg::Strings::to_utf16(s)); #else |
