mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-08-11 17:49:02 +08:00
refs #33, added test for trailing preferred seperator on last '..' for path::lexically_normal
This commit is contained in:
parent
8302328ef9
commit
cf5188899b
@ -2644,6 +2644,12 @@ GHC_INLINE path path::lexically_normal() const
|
||||
if (dest.empty()) {
|
||||
dest = ".";
|
||||
}
|
||||
else {
|
||||
static const path suffix[2] = {"", ".."};
|
||||
if(std::equal(std::reverse_iterator<path::const_iterator>(dest.end()), std::reverse_iterator<path::const_iterator>(dest.begin()), suffix)) {
|
||||
dest._path.pop_back();
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
@ -873,10 +873,12 @@ TEST_CASE("30.10.8.4.11 path generation", "[filesystem][path][fs.path.gen]")
|
||||
CHECK(fs::path("foo/..").lexically_normal() == ".");
|
||||
CHECK(fs::path("ab/cd/ef/../../qw").lexically_normal() == "ab/qw");
|
||||
CHECK(fs::path("a/b/../../../c").lexically_normal() == "../c");
|
||||
CHECK(fs::path("../").lexically_normal() == "..");
|
||||
#ifdef GHC_OS_WINDOWS
|
||||
CHECK(fs::path("\\/\\///\\/").lexically_normal() == "/");
|
||||
CHECK(fs::path("a/b/..\\//..///\\/../c\\\\/").lexically_normal() == "../c/");
|
||||
CHECK(fs::path("..a/b/..\\//..///\\/../c\\\\/").lexically_normal() == "../c/");
|
||||
CHECK(fs::path("..\\").lexically_normal() == "..");
|
||||
#endif
|
||||
|
||||
// lexically_relative()
|
||||
|
Loading…
x
Reference in New Issue
Block a user