aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/database.c2
-rw-r--r--src/directory.c8
-rw-r--r--src/directory.h9
3 files changed, 13 insertions, 6 deletions
diff --git a/src/database.c b/src/database.c
index a6ae59f62..94527e72d 100644
--- a/src/database.c
+++ b/src/database.c
@@ -104,7 +104,7 @@ db_get_directory(const char *name)
if (name == NULL)
return music_root;
- return directory_get_directory(music_root, name);
+ return directory_lookup_directory(music_root, name);
}
struct song *
diff --git a/src/directory.c b/src/directory.c
index 039bdcbe1..ef2cd1c2c 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -82,19 +82,19 @@ directory_prune_empty(struct directory *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 *found = NULL;
char *duplicated;
char *locate;
- assert(name != NULL);
+ assert(uri != NULL);
- if (isRootDirectory(name))
+ if (isRootDirectory(uri))
return directory;
- duplicated = g_strdup(name);
+ duplicated = g_strdup(uri);
locate = strchr(duplicated, '/');
while (1) {
if (locate)
diff --git a/src/directory.h b/src/directory.h
index 592d5cbb0..cd5c53dfb 100644
--- a/src/directory.h
+++ b/src/directory.h
@@ -98,8 +98,15 @@ directory_new_child(struct directory *directory, const char *name)
void
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 *
-directory_get_directory(struct directory *directory, const char *name);
+directory_lookup_directory(struct directory *directory, const char *uri);
void
directory_sort(struct directory *directory);