directory: use strrchr() instead of g_basename()

g_basename() is deprecated in GLib 2.32.
This commit is contained in:
Max Kellermann 2012-04-04 19:08:05 +02:00
parent 09aa0dc676
commit d8e423df1a
1 changed files with 9 additions and 1 deletions

View File

@ -68,7 +68,15 @@ directory_free(struct directory *directory)
const char *
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