Commit 83e6e3e3 authored by Denis Krjuchkov's avatar Denis Krjuchkov

fs/Traits.cxx: don't return empty string if parent dir is root

parent c3870312
......@@ -64,7 +64,9 @@ PathTraitsUTF8::GetParent(PathTraitsUTF8::const_pointer p)
assert(p != nullptr);
const char *slash = strrchr(p, SEPARATOR);
return slash != nullptr
? std::string(p, slash)
: std::string(".");
if (slash == nullptr)
return std::string(".");
if (slash == p)
return std::string(p, p + 1);
return std::string(p, slash);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment