Commit 9dc0b070 authored by Warren Dukes's avatar Warren Dukes

fix a bug in pringSongUrl, don't print leading '/' for songs in root dir

git-svn-id: https://svn.musicpd.org/mpd/trunk@2631 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 0473f3ea
...@@ -250,7 +250,7 @@ Directory * newDirectory(char * dirname, Directory * parent) { ...@@ -250,7 +250,7 @@ Directory * newDirectory(char * dirname, Directory * parent) {
directory = malloc(sizeof(Directory)); directory = malloc(sizeof(Directory));
if(dirname!=NULL) directory->path = strdup(dirname); if(dirname && strlen(dirname)) directory->path = strdup(dirname);
else directory->path = NULL; else directory->path = NULL;
directory->subDirectories = newDirectoryList(); directory->subDirectories = newDirectoryList();
directory->songs = newSongList(); directory->songs = newSongList();
......
...@@ -118,7 +118,7 @@ void freeSongList(SongList * list) { ...@@ -118,7 +118,7 @@ void freeSongList(SongList * list) {
} }
void printSongUrl(FILE * fp, Song * song) { void printSongUrl(FILE * fp, Song * song) {
if(song->parentDir) { if(song->parentDir && song->parentDir->path) {
myfprintf(fp, "%s%s/%s\n", SONG_FILE, myfprintf(fp, "%s%s/%s\n", SONG_FILE,
getDirectoryPath(song->parentDir), song->url); getDirectoryPath(song->parentDir), song->url);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment