forked from len0rd/rockbox
Make resuming a directory bookmark more robust (e.g., when the directory no longer exists).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13131 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e6de6e5f8a
commit
ec88dffb6c
1 changed files with 13 additions and 4 deletions
17
apps/tree.c
17
apps/tree.c
|
@ -1191,19 +1191,28 @@ void bookmark_play(char *resume_file, int index, int offset, int seed,
|
||||||
lastdir[0]='\0';
|
lastdir[0]='\0';
|
||||||
if (playlist_create(resume_file, NULL) != -1)
|
if (playlist_create(resume_file, NULL) != -1)
|
||||||
{
|
{
|
||||||
|
char* peek_filename;
|
||||||
resume_directory(resume_file);
|
resume_directory(resume_file);
|
||||||
if (global_settings.playlist_shuffle)
|
if (global_settings.playlist_shuffle)
|
||||||
playlist_shuffle(seed, -1);
|
playlist_shuffle(seed, -1);
|
||||||
|
|
||||||
/* Check if the file is at the same spot in the directory,
|
/* Check if the file is at the same spot in the directory,
|
||||||
else search for it */
|
else search for it */
|
||||||
if ((strcmp(strrchr(playlist_peek(index),'/') + 1,
|
peek_filename = playlist_peek(index);
|
||||||
filename)))
|
|
||||||
|
if (peek_filename == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (strcmp(strrchr(peek_filename, '/') + 1, filename))
|
||||||
{
|
{
|
||||||
for ( i=0; i < playlist_amount(); i++ )
|
for ( i=0; i < playlist_amount(); i++ )
|
||||||
{
|
{
|
||||||
if ((strcmp(strrchr(playlist_peek(i),'/') + 1,
|
peek_filename = playlist_peek(i);
|
||||||
filename)) == 0)
|
|
||||||
|
if (peek_filename == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!strcmp(strrchr(peek_filename, '/') + 1, filename))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i < playlist_amount())
|
if (i < playlist_amount())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue