Skip to content

Commit

Permalink
[vcpkg] Fix build for mingw (#15504)
Browse files Browse the repository at this point in the history
* fix build

* stop the templateness

none of the major three implementations have string::const_iterator = char const*
  • Loading branch information
strega-nil authored Jan 8, 2021
1 parent 2a42024 commit 36cd510
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
13 changes: 2 additions & 11 deletions toolsrc/include/vcpkg/base/files.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions toolsrc/src/vcpkg/base/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 36cd510

Please sign in to comment.