directory: added directory_get_name()

directory_get_name() returns the base name of the directory.
This commit is contained in:
Max Kellermann 2008-10-13 16:32:39 +02:00
parent bc85e92a72
commit 3b6ff84393
2 changed files with 13 additions and 0 deletions

View File

@ -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)
{

View File

@ -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)
{