From ee2b3ce4b8436a0bb95d83c482884df48f7d0459 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Wed, 18 Aug 2010 00:01:38 +0200 Subject: Strip trailing slashes when finding directories. --- music.c | 4 ++++ 1 file changed, 4 insertions(+) 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 +#include 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); -- cgit v1.2.3