mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
refs #156: Windows path handling artifact bled into POSIX
This commit is contained in:
parent
cd6805e94d
commit
efc077f553
@ -3365,10 +3365,14 @@ GHC_INLINE path::impl_string_type::const_iterator path::iterator::increment(cons
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef GHC_OS_WINDOWS
|
||||
if (fromStart && i != _last && *i == ':') {
|
||||
++i;
|
||||
}
|
||||
else {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
i = std::find(i, _last, preferred_separator);
|
||||
}
|
||||
}
|
||||
|
@ -790,6 +790,9 @@ TEST_CASE("fs.path.decompose - path decomposition", "[filesystem][path][fs.path.
|
||||
CHECK(fs::path("C:/foo").filename() == "foo");
|
||||
CHECK(fs::path("C:\\foo").filename() == "foo");
|
||||
CHECK(fs::path("C:foo").filename() == "foo");
|
||||
CHECK(fs::path("t:est.txt").filename() == "est.txt");
|
||||
#else
|
||||
CHECK(fs::path("t:est.txt").filename() == "t:est.txt");
|
||||
#endif
|
||||
|
||||
// stem()
|
||||
@ -807,6 +810,11 @@ TEST_CASE("fs.path.decompose - path decomposition", "[filesystem][path][fs.path.
|
||||
CHECK(fs::path("/foo/.profile").stem() == ".profile");
|
||||
CHECK(fs::path(".bar").stem() == ".bar");
|
||||
CHECK(fs::path("..bar").stem() == ".");
|
||||
#ifdef GHC_OS_WINDOWS
|
||||
CHECK(fs::path("t:est.txt").stem() == "est");
|
||||
#else
|
||||
CHECK(fs::path("t:est.txt").stem() == "t:est");
|
||||
#endif
|
||||
|
||||
// extension()
|
||||
CHECK(fs::path("/foo/bar.txt").extension() == ".txt");
|
||||
@ -814,6 +822,7 @@ TEST_CASE("fs.path.decompose - path decomposition", "[filesystem][path][fs.path.
|
||||
CHECK(fs::path("/foo/.profile").extension() == "");
|
||||
CHECK(fs::path(".bar").extension() == "");
|
||||
CHECK(fs::path("..bar").extension() == ".bar");
|
||||
CHECK(fs::path("t:est.txt").extension() == ".txt");
|
||||
|
||||
if (has_host_root_name_support()) {
|
||||
// //host-based root-names
|
||||
|
Loading…
x
Reference in New Issue
Block a user