Commit d8e423df authored by Max Kellermann's avatar Max Kellermann

directory: use strrchr() instead of g_basename()

g_basename() is deprecated in GLib 2.32.
parent 09aa0dc6
...@@ -68,7 +68,15 @@ directory_free(struct directory *directory) ...@@ -68,7 +68,15 @@ directory_free(struct directory *directory)
const char * const char *
directory_get_name(const struct directory *directory) directory_get_name(const struct directory *directory)
{ {
return g_basename(directory->path); assert(!directory_is_root(directory));
assert(directory->path != NULL);
const char *slash = strrchr(directory->path, '/');
assert((slash == NULL) == directory_is_root(directory->parent));
return slash != NULL
? slash + 1
: directory->path;
} }
void void
......
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