summaryrefslogtreecommitdiff
path: root/src/db/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/plugins')
-rw-r--r--src/db/plugins/simple/Directory.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/db/plugins/simple/Directory.cxx b/src/db/plugins/simple/Directory.cxx
index 27602afc2..66aa6cd48 100644
--- a/src/db/plugins/simple/Directory.cxx
+++ b/src/db/plugins/simple/Directory.cxx
@@ -32,6 +32,7 @@
#include "fs/Traits.hxx"
#include "util/Alloc.hxx"
#include "util/DeleteDisposer.hxx"
+#include "util/StringCompare.hxx"
#include <assert.h>
#include <string.h>
@@ -69,7 +70,15 @@ Directory::GetName() const noexcept
{
assert(!IsRoot());
- return PathTraitsUTF8::GetBase(path.c_str());
+ if (parent->IsRoot())
+ return path.c_str();
+
+ assert(StringAfterPrefix(path.c_str(), parent->path.c_str()) != nullptr);
+ assert(*StringAfterPrefix(path.c_str(), parent->path.c_str()) == PathTraitsUTF8::SEPARATOR);
+
+ /* strip the parent directory path and the slash separator
+ from this directory's path, and the base name remains */
+ return path.c_str() + parent->path.length() + 1;
}
Directory *