directory: added directory_get_name()
directory_get_name() returns the base name of the directory.
This commit is contained in:
parent
bc85e92a72
commit
3b6ff84393
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "directory.h"
|
#include "directory.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "path.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -49,6 +50,12 @@ directory_free(struct directory *directory)
|
|||||||
/*directory_get_path(NULL); */
|
/*directory_get_path(NULL); */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
directory_get_name(const struct directory *directory)
|
||||||
|
{
|
||||||
|
return mpd_basename(directory->path);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
directory_prune_empty(struct directory *directory)
|
directory_prune_empty(struct directory *directory)
|
||||||
{
|
{
|
||||||
|
@ -68,6 +68,12 @@ directory_get_path(const struct directory *directory)
|
|||||||
return directory->path;
|
return directory->path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the base name of the directory.
|
||||||
|
*/
|
||||||
|
const char *
|
||||||
|
directory_get_name(const struct directory *directory);
|
||||||
|
|
||||||
static inline struct directory *
|
static inline struct directory *
|
||||||
directory_get_child(const struct directory *directory, const char *name)
|
directory_get_child(const struct directory *directory, const char *name)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user