directory: renamed directory_get_directory()
Renamed directory_get_directory() to directory_lookup_directory(). Added API documentation.
This commit is contained in:
parent
932f70da86
commit
36ec2edacf
@ -104,7 +104,7 @@ db_get_directory(const char *name)
|
|||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return music_root;
|
return music_root;
|
||||||
|
|
||||||
return directory_get_directory(music_root, name);
|
return directory_lookup_directory(music_root, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct song *
|
struct song *
|
||||||
|
@ -82,19 +82,19 @@ directory_prune_empty(struct directory *directory)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct directory *
|
struct directory *
|
||||||
directory_get_directory(struct directory *directory, const char *name)
|
directory_lookup_directory(struct directory *directory, const char *uri)
|
||||||
{
|
{
|
||||||
struct directory *cur = directory;
|
struct directory *cur = directory;
|
||||||
struct directory *found = NULL;
|
struct directory *found = NULL;
|
||||||
char *duplicated;
|
char *duplicated;
|
||||||
char *locate;
|
char *locate;
|
||||||
|
|
||||||
assert(name != NULL);
|
assert(uri != NULL);
|
||||||
|
|
||||||
if (isRootDirectory(name))
|
if (isRootDirectory(uri))
|
||||||
return directory;
|
return directory;
|
||||||
|
|
||||||
duplicated = g_strdup(name);
|
duplicated = g_strdup(uri);
|
||||||
locate = strchr(duplicated, '/');
|
locate = strchr(duplicated, '/');
|
||||||
while (1) {
|
while (1) {
|
||||||
if (locate)
|
if (locate)
|
||||||
|
@ -98,8 +98,15 @@ directory_new_child(struct directory *directory, const char *name)
|
|||||||
void
|
void
|
||||||
directory_prune_empty(struct directory *directory);
|
directory_prune_empty(struct directory *directory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Looks up a directory by its relative URI.
|
||||||
|
*
|
||||||
|
* @param directory the parent (or grandparent, ...) directory
|
||||||
|
* @param uri the relative URI
|
||||||
|
* @return the directory, or NULL if none was found
|
||||||
|
*/
|
||||||
struct directory *
|
struct directory *
|
||||||
directory_get_directory(struct directory *directory, const char *name);
|
directory_lookup_directory(struct directory *directory, const char *uri);
|
||||||
|
|
||||||
void
|
void
|
||||||
directory_sort(struct directory *directory);
|
directory_sort(struct directory *directory);
|
||||||
|
Loading…
Reference in New Issue
Block a user