Squashed commit of the following:

commit 333fc89c7d3f8962d7bc1025565c27e046f28e28
Author: Steffen Schümann <s.schuemann@pobox.com>
Date:   Sat Jul 11 18:37:05 2026 +0200

    Removed extra tests that were added but unrelated to the fix.

commit 542f355853fcae25e788c4514fe57494200797ce
Author: Steffen Schümann <s.schuemann@pobox.com>
Date:   Sat Jul 11 18:29:40 2026 +0200

    lexically_normal() preserves IPv6 components in device UNC paths (#170)
This commit is contained in:
Steffen Schümann 2026-07-11 20:18:58 +02:00
parent 4d2f630892
commit 730589f53e
3 changed files with 14 additions and 1 deletions

View File

@ -653,6 +653,8 @@ to the expected behavior.
support, with iteration errors terminating the process. support, with iteration errors terminating the process.
* Fix for [#191](https://github.com/gulrak/filesystem/issues/191), appending * Fix for [#191](https://github.com/gulrak/filesystem/issues/191), appending
to a host-only UNC path now inserts the missing separator. to a host-only UNC path now inserts the missing separator.
* Fix for [#170](https://github.com/gulrak/filesystem/issues/170),
`lexically_normal()` now preserves IPv6 components in device UNC paths.
* Fix for [#185](https://github.com/gulrak/filesystem/issues/185), * Fix for [#185](https://github.com/gulrak/filesystem/issues/185),
`lexically_normal()` now preserves unresolved parent components in relative `lexically_normal()` now preserves unresolved parent components in relative
paths. paths.

View File

@ -3290,7 +3290,12 @@ GHC_INLINE path path::lexically_normal() const
} }
} }
if (!(s.empty() && lastDotDot)) { if (!(s.empty() && lastDotDot)) {
dest /= s; if (dest.has_relative_path()) {
dest.append_name(s.c_str());
}
else {
dest /= s;
}
} }
lastDotDot = s == ".."; lastDotDot = s == "..";
} }

View File

@ -972,6 +972,12 @@ TEST_CASE("fs.path.gen - path generation", "[filesystem][path][fs.path.gen]")
CHECK(fs::path("a/b/..\\//..///\\/../c\\\\/").lexically_normal() == "../c/"); CHECK(fs::path("a/b/..\\//..///\\/../c\\\\/").lexically_normal() == "../c/");
CHECK(fs::path("..a/b/..\\//..///\\/../c\\\\/").lexically_normal() == "../c/"); CHECK(fs::path("..a/b/..\\//..///\\/../c\\\\/").lexically_normal() == "../c/");
CHECK(fs::path("..\\").lexically_normal() == ".."); CHECK(fs::path("..\\").lexically_normal() == "..");
CHECK(fs::path("//?/UNC/::1/c$/foo").lexically_normal() == R"(\\?\UNC\::1\c$\foo)");
CHECK(fs::path(R"(\\?\UNC\a::1\c$\foo)").lexically_normal() == R"(\\?\UNC\a::1\c$\foo)");
CHECK(fs::path(R"(\\?\UNC\fe80::1\c$\foo)").lexically_normal() == R"(\\?\UNC\fe80::1\c$\foo)");
CHECK(fs::path(R"(\\?\UNC\server\share\foo)").lexically_normal() == R"(\\?\UNC\server\share\foo)");
CHECK(fs::path(R"(\\server\share\foo)").lexically_normal() == R"(\\server\share\foo)");
CHECK(fs::path(R"(C:foo\..\bar)").lexically_normal() == R"(C:bar)");
#endif #endif
// lexically_relative() // lexically_relative()