From c7c3d5e2ab364471738008aa68cd44df70233551 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 12 Jun 2002 07:07:45 +0000 Subject: fix multiple slash problems git-svn-id: svn://svn.rockbox.org/rockbox/trunk@965 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/playlist.c b/apps/playlist.c index 5e22c86d8c..c282dc1cfd 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); -- cgit v1.2.3