diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playlist.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index ce812c7c67..38eca09fc9 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -192,7 +192,6 @@ char* playlist_peek(int steps) | |||
192 | 192 | ||
193 | if('/' == buf[0]) { | 193 | if('/' == buf[0]) { |
194 | strcpy(now_playing, &buf[0]); | 194 | strcpy(now_playing, &buf[0]); |
195 | return now_playing; | ||
196 | } | 195 | } |
197 | else { | 196 | else { |
198 | strncpy(dir_buf, playlist.filename, playlist.dirlen-1); | 197 | strncpy(dir_buf, playlist.filename, playlist.dirlen-1); |
@@ -201,7 +200,6 @@ char* playlist_peek(int steps) | |||
201 | /* handle dos style drive letter */ | 200 | /* handle dos style drive letter */ |
202 | if ( ':' == buf[1] ) { | 201 | if ( ':' == buf[1] ) { |
203 | strcpy(now_playing, &buf[2]); | 202 | strcpy(now_playing, &buf[2]); |
204 | return now_playing; | ||
205 | } | 203 | } |
206 | else if ( '.' == buf[0] && '.' == buf[1] && '/' == buf[2] ) { | 204 | else if ( '.' == buf[0] && '.' == buf[1] && '/' == buf[2] ) { |
207 | /* handle relative paths */ | 205 | /* handle relative paths */ |
@@ -218,17 +216,35 @@ char* playlist_peek(int steps) | |||
218 | break; | 216 | break; |
219 | } | 217 | } |
220 | snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, &buf[seek]); | 218 | snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, &buf[seek]); |
221 | return now_playing; | ||
222 | } | 219 | } |
223 | else if ( '.' == buf[0] && '/' == buf[1] ) { | 220 | else if ( '.' == buf[0] && '/' == buf[1] ) { |
224 | snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, &buf[2]); | 221 | snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, &buf[2]); |
225 | return now_playing; | ||
226 | } | 222 | } |
227 | else { | 223 | else { |
228 | snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, buf); | 224 | snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, buf); |
229 | return now_playing; | ||
230 | } | 225 | } |
231 | } | 226 | } |
227 | |||
228 | buf = now_playing; | ||
229 | |||
230 | /* remove bogus dirs from beginning of path | ||
231 | (workaround for buggy playlist creation tools) */ | ||
232 | while (buf) | ||
233 | { | ||
234 | fd = open(buf, O_RDONLY); | ||
235 | if (fd > 0) | ||
236 | { | ||
237 | close(fd); | ||
238 | break; | ||
239 | } | ||
240 | |||
241 | buf = strchr(buf+1, '/'); | ||
242 | } | ||
243 | |||
244 | if (buf) | ||
245 | return buf; | ||
246 | |||
247 | return now_playing; | ||
232 | } | 248 | } |
233 | 249 | ||
234 | /* | 250 | /* |