diff --git a/src/db/plugins/simple/Directory.cxx b/src/db/plugins/simple/Directory.cxx
index 7f58d1429..fd014f96c 100644
--- a/src/db/plugins/simple/Directory.cxx
+++ b/src/db/plugins/simple/Directory.cxx
@@ -53,20 +53,20 @@ Directory::Delete() noexcept
 					   DeleteDisposer());
 }
 
-const char *
+std::string_view
 Directory::GetName() const noexcept
 {
 	assert(!IsRoot());
 
 	if (parent->IsRoot())
-		return path.c_str();
+		return path;
 
-	assert(StringAfterPrefix(path.c_str(), parent->path.c_str()) != nullptr);
-	assert(*StringAfterPrefix(path.c_str(), parent->path.c_str()) == PathTraitsUTF8::SEPARATOR);
+	assert(path.starts_with(parent->path));
+	assert(path[parent->path.length()] == 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;
+	return std::string_view{path}.substr(parent->path.length() + 1);
 }
 
 Directory *
diff --git a/src/db/plugins/simple/Directory.hxx b/src/db/plugins/simple/Directory.hxx
index 7500d194b..dacc9e064 100644
--- a/src/db/plugins/simple/Directory.hxx
+++ b/src/db/plugins/simple/Directory.hxx
@@ -208,7 +208,7 @@ public:
 	 * Returns the base name of the directory.
 	 */
 	[[gnu::pure]]
-	const char *GetName() const noexcept;
+	std::string_view GetName() const noexcept;
 
 	/**
 	 * Is this the root directory of the music database?