mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-04 11:13:58 +08:00
refs #166, ".." does not have extension ."
This commit is contained in:
parent
8a2edd6d92
commit
e5ae1bd3e3
@ -3170,7 +3170,7 @@ GHC_INLINE path path::extension() const
|
||||
auto iter = end();
|
||||
const auto& fn = *--iter;
|
||||
impl_string_type::size_type pos = fn._path.rfind('.');
|
||||
if (pos != std::string::npos && pos > 0) {
|
||||
if (pos != std::string::npos && pos > 0 && fn._path != "..") {
|
||||
return path(fn._path.substr(pos), native_format);
|
||||
}
|
||||
}
|
||||
|
@ -817,6 +817,8 @@ TEST_CASE("fs.path.decompose - path decomposition", "[filesystem][path][fs.path.
|
||||
#else
|
||||
CHECK(fs::path("t:est.txt").stem() == "t:est");
|
||||
#endif
|
||||
CHECK(fs::path("/foo/.").stem() == ".");
|
||||
CHECK(fs::path("/foo/..").stem() == "..");
|
||||
|
||||
// extension()
|
||||
CHECK(fs::path("/foo/bar.txt").extension() == ".txt");
|
||||
@ -825,6 +827,8 @@ TEST_CASE("fs.path.decompose - path decomposition", "[filesystem][path][fs.path.
|
||||
CHECK(fs::path(".bar").extension() == "");
|
||||
CHECK(fs::path("..bar").extension() == ".bar");
|
||||
CHECK(fs::path("t:est.txt").extension() == ".txt");
|
||||
CHECK(fs::path("/foo/.").extension() == "");
|
||||
CHECK(fs::path("/foo/..").extension() == "");
|
||||
|
||||
if (has_host_root_name_support()) {
|
||||
// //host-based root-names
|
||||
|
Loading…
x
Reference in New Issue
Block a user