Skip to content

Commit

Permalink
Extended path prefix handling on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
gulrak committed Oct 9, 2020
1 parent ff6e5e8 commit 6649653
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions include/ghc/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1654,12 +1654,17 @@ GHC_INLINE void path::postprocess_path_with_format(path::impl_string_type& p, pa
#ifdef GHC_OS_WINDOWS
case path::auto_format:
case path::native_format:
if (detail::startsWith(p, std::string("\\\\?\\"))) {
// remove Windows long filename marker
p.erase(0, 4);
if (detail::startsWith(p, std::string("UNC\\"))) {
p.erase(0, 2);
p[0] = '\\';
if (p.length() > 4 && p[2] == '?') {
if (detail::startsWith(p, std::string("\\\\?\\"))) {
// remove Windows long filename marker
p.erase(0, 4);
if (detail::startsWith(p, std::string("UNC\\"))) {
p.erase(0, 2);
p[0] = '\\';
}
}
else if (detail::startsWith(p, std::string("\\??\\"))) {
p.erase(0, 4);
}
}
for (auto& c : p) {
Expand Down

0 comments on commit 6649653

Please sign in to comment.