fs/Traits.cxx: don't return empty string if parent dir is root
This commit is contained in:
parent
c387031252
commit
83e6e3e31f
@ -64,7 +64,9 @@ PathTraitsUTF8::GetParent(PathTraitsUTF8::const_pointer p)
|
|||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
|
|
||||||
const char *slash = strrchr(p, SEPARATOR);
|
const char *slash = strrchr(p, SEPARATOR);
|
||||||
return slash != nullptr
|
if (slash == nullptr)
|
||||||
? std::string(p, slash)
|
return std::string(".");
|
||||||
: std::string(".");
|
if (slash == p)
|
||||||
|
return std::string(p, p + 1);
|
||||||
|
return std::string(p, slash);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user