directory: use strrchr() instead of g_basename()
g_basename() is deprecated in GLib 2.32.
This commit is contained in:
parent
09aa0dc676
commit
d8e423df1a
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue