mirror of
https://github.com/gulrak/filesystem.git
synced 2026-07-30 16:26:11 +08:00
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:
parent
4d2f630892
commit
730589f53e
@ -653,6 +653,8 @@ to the expected behavior.
|
||||
support, with iteration errors terminating the process.
|
||||
* Fix for [#191](https://github.com/gulrak/filesystem/issues/191), appending
|
||||
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),
|
||||
`lexically_normal()` now preserves unresolved parent components in relative
|
||||
paths.
|
||||
|
||||
@ -3290,8 +3290,13 @@ GHC_INLINE path path::lexically_normal() const
|
||||
}
|
||||
}
|
||||
if (!(s.empty() && lastDotDot)) {
|
||||
if (dest.has_relative_path()) {
|
||||
dest.append_name(s.c_str());
|
||||
}
|
||||
else {
|
||||
dest /= s;
|
||||
}
|
||||
}
|
||||
lastDotDot = s == "..";
|
||||
}
|
||||
if (dest.empty()) {
|
||||
|
||||
@ -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("..\\").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
|
||||
|
||||
// lexically_relative()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user