diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-08-18 00:01:38 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-08-18 00:01:38 +0200 |
commit | ee2b3ce4b8436a0bb95d83c482884df48f7d0459 (patch) | |
tree | dcf8acd4ec53096ff87d7db41aae1996f4d90748 | |
parent | 052f74f4db45219d731e7af6dcb9beb5eec2344c (diff) |
Strip trailing slashes when finding directories.
-rw-r--r-- | music.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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); |