summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-08-18 00:01:38 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2010-08-18 00:01:38 +0200
commitee2b3ce4b8436a0bb95d83c482884df48f7d0459 (patch)
treedcf8acd4ec53096ff87d7db41aae1996f4d90748
parent052f74f4db45219d731e7af6dcb9beb5eec2344c (diff)
Strip trailing slashes when finding directories.
-rw-r--r--music.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/music.c b/music.c
index 321481c..c68504d 100644
--- a/music.c
+++ b/music.c
@@ -1,6 +1,7 @@
#include "music.h"
#include <glib/gstdio.h>
+#include <string.h>
struct directory *music_root = NULL;
@@ -88,6 +89,9 @@ static struct directory *music_find_dir_rec(struct directory *root, const gchar
struct directory *music_find_dir(const gchar *path) {
gchar *real_path = g_build_filename(music_root->path, path, NULL);
+ int len = strlen(real_path);
+ if(real_path[len - 1] == '/')
+ real_path[len - 1] = '\0';
struct directory *dir = music_find_dir_rec(music_root, real_path);