summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-06-12 07:07:45 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-06-12 07:07:45 +0000
commitc7c3d5e2ab364471738008aa68cd44df70233551 (patch)
treecbccbf52673b69811fbda77a5d81ed25aa2ad379
parent4bf4a272a4cde9de949ae164d2a9036e8353a8e6 (diff)
downloadrockbox-c7c3d5e2ab364471738008aa68cd44df70233551.zip
rockbox-c7c3d5e2ab364471738008aa68cd44df70233551.tar.gz
rockbox-c7c3d5e2ab364471738008aa68cd44df70233551.tar.bz2
rockbox-c7c3d5e2ab364471738008aa68cd44df70233551.tar.xz
fix multiple slash problems
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@965 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playlist.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 5e22c86..c282dc1 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -49,9 +49,6 @@ char* playlist_next(int type)
max = read(fd, now_playing+1, sizeof(now_playing)-1);
close(fd);
- /* Only absolute paths allowed */
- now_playing[0] = '/';
-
/* Zero-terminate the file name */
seek=0;
while((now_playing[seek] != '\n') &&
@@ -61,18 +58,28 @@ char* playlist_next(int type)
now_playing[seek]=0;
- return now_playing;
+ if('/' == now_playing[1])
+ return &now_playing[1];
+ else
+ return now_playing;
}
else
- return NULL;
+ return NULL;
}
void play_list(char *dir, char *file)
{
+ char *sep="";
empty_playlist(&playlist);
+ /* If the dir does not end in trailing new line, we use a separator.
+ Otherwise we don't. */
+ if('/' != dir[strlen(dir)-1])
+ sep="/";
+
snprintf(playlist.filename, sizeof(playlist.filename),
- "%s/%s", dir, file);
+ "%s%s%s",
+ dir, sep, file);
/* add track indices to playlist data structure */
add_indices_to_playlist(&playlist);