diff options
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/Traits.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/fs/Traits.cxx b/src/fs/Traits.cxx index 47feda25b..7dd8d20b6 100644 --- a/src/fs/Traits.cxx +++ b/src/fs/Traits.cxx @@ -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); } |