diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playlist.c | 19 |
1 files 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) | |||
49 | max = read(fd, now_playing+1, sizeof(now_playing)-1); | 49 | max = read(fd, now_playing+1, sizeof(now_playing)-1); |
50 | close(fd); | 50 | close(fd); |
51 | 51 | ||
52 | /* Only absolute paths allowed */ | ||
53 | now_playing[0] = '/'; | ||
54 | |||
55 | /* Zero-terminate the file name */ | 52 | /* Zero-terminate the file name */ |
56 | seek=0; | 53 | seek=0; |
57 | while((now_playing[seek] != '\n') && | 54 | while((now_playing[seek] != '\n') && |
@@ -61,18 +58,28 @@ char* playlist_next(int type) | |||
61 | 58 | ||
62 | now_playing[seek]=0; | 59 | now_playing[seek]=0; |
63 | 60 | ||
64 | return now_playing; | 61 | if('/' == now_playing[1]) |
62 | return &now_playing[1]; | ||
63 | else | ||
64 | return now_playing; | ||
65 | } | 65 | } |
66 | else | 66 | else |
67 | return NULL; | 67 | return NULL; |
68 | } | 68 | } |
69 | 69 | ||
70 | void play_list(char *dir, char *file) | 70 | void play_list(char *dir, char *file) |
71 | { | 71 | { |
72 | char *sep=""; | ||
72 | empty_playlist(&playlist); | 73 | empty_playlist(&playlist); |
73 | 74 | ||
75 | /* If the dir does not end in trailing new line, we use a separator. | ||
76 | Otherwise we don't. */ | ||
77 | if('/' != dir[strlen(dir)-1]) | ||
78 | sep="/"; | ||
79 | |||
74 | snprintf(playlist.filename, sizeof(playlist.filename), | 80 | snprintf(playlist.filename, sizeof(playlist.filename), |
75 | "%s/%s", dir, file); | 81 | "%s%s%s", |
82 | dir, sep, file); | ||
76 | 83 | ||
77 | /* add track indices to playlist data structure */ | 84 | /* add track indices to playlist data structure */ |
78 | add_indices_to_playlist(&playlist); | 85 | add_indices_to_playlist(&playlist); |