Remove bogus dirs from beginning of playlist file path. Patch by Hardeep Sidhu.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3039 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
02e1b626b6
commit
0e342181c3
1 changed files with 21 additions and 5 deletions
|
@ -192,7 +192,6 @@ char* playlist_peek(int steps)
|
||||||
|
|
||||||
if('/' == buf[0]) {
|
if('/' == buf[0]) {
|
||||||
strcpy(now_playing, &buf[0]);
|
strcpy(now_playing, &buf[0]);
|
||||||
return now_playing;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strncpy(dir_buf, playlist.filename, playlist.dirlen-1);
|
strncpy(dir_buf, playlist.filename, playlist.dirlen-1);
|
||||||
|
@ -201,7 +200,6 @@ char* playlist_peek(int steps)
|
||||||
/* handle dos style drive letter */
|
/* handle dos style drive letter */
|
||||||
if ( ':' == buf[1] ) {
|
if ( ':' == buf[1] ) {
|
||||||
strcpy(now_playing, &buf[2]);
|
strcpy(now_playing, &buf[2]);
|
||||||
return now_playing;
|
|
||||||
}
|
}
|
||||||
else if ( '.' == buf[0] && '.' == buf[1] && '/' == buf[2] ) {
|
else if ( '.' == buf[0] && '.' == buf[1] && '/' == buf[2] ) {
|
||||||
/* handle relative paths */
|
/* handle relative paths */
|
||||||
|
@ -218,17 +216,35 @@ char* playlist_peek(int steps)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, &buf[seek]);
|
snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, &buf[seek]);
|
||||||
return now_playing;
|
|
||||||
}
|
}
|
||||||
else if ( '.' == buf[0] && '/' == buf[1] ) {
|
else if ( '.' == buf[0] && '/' == buf[1] ) {
|
||||||
snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, &buf[2]);
|
snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, &buf[2]);
|
||||||
return now_playing;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, buf);
|
snprintf(now_playing, MAX_PATH+1, "%s/%s", dir_buf, buf);
|
||||||
return now_playing;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf = now_playing;
|
||||||
|
|
||||||
|
/* remove bogus dirs from beginning of path
|
||||||
|
(workaround for buggy playlist creation tools) */
|
||||||
|
while (buf)
|
||||||
|
{
|
||||||
|
fd = open(buf, O_RDONLY);
|
||||||
|
if (fd > 0)
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = strchr(buf+1, '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buf)
|
||||||
|
return buf;
|
||||||
|
|
||||||
|
return now_playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue