diff options
Diffstat (limited to '')
-rw-r--r-- | src/directory.c | 7 | ||||
-rw-r--r-- | src/directory.h | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/directory.c b/src/directory.c index 002cb65e3..f11695a95 100644 --- a/src/directory.c +++ b/src/directory.c @@ -18,6 +18,7 @@ #include "directory.h" #include "utils.h" +#include "path.h" #include <assert.h> #include <string.h> @@ -49,6 +50,12 @@ directory_free(struct directory *directory) /*directory_get_path(NULL); */ } +const char * +directory_get_name(const struct directory *directory) +{ + return mpd_basename(directory->path); +} + void directory_prune_empty(struct directory *directory) { diff --git a/src/directory.h b/src/directory.h index a7a632ebc..8cb5ed5f8 100644 --- a/src/directory.h +++ b/src/directory.h @@ -68,6 +68,12 @@ directory_get_path(const struct directory *directory) return directory->path; } +/** + * Returns the base name of the directory. + */ +const char * +directory_get_name(const struct directory *directory); + static inline struct directory * directory_get_child(const struct directory *directory, const char *name) { |