diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2007-04-12 19:11:39 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2007-04-12 19:11:39 +0000 |
commit | ec88dffb6cde1b0e88c813e1676c8e989668fd9b (patch) | |
tree | 4d48a05061f5b4a07ee02d4ea5f14ec4e719d17f /apps/tree.c | |
parent | e6de6e5f8ae96649d0bdf1a26fc135e755c6f183 (diff) | |
download | rockbox-ec88dffb6cde1b0e88c813e1676c8e989668fd9b.tar.gz rockbox-ec88dffb6cde1b0e88c813e1676c8e989668fd9b.zip |
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
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/apps/tree.c b/apps/tree.c index 723c003ca9..4e4d4c7a9a 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -1191,19 +1191,28 @@ void bookmark_play(char *resume_file, int index, int offset, int seed, | |||
1191 | lastdir[0]='\0'; | 1191 | lastdir[0]='\0'; |
1192 | if (playlist_create(resume_file, NULL) != -1) | 1192 | if (playlist_create(resume_file, NULL) != -1) |
1193 | { | 1193 | { |
1194 | char* peek_filename; | ||
1194 | resume_directory(resume_file); | 1195 | resume_directory(resume_file); |
1195 | if (global_settings.playlist_shuffle) | 1196 | if (global_settings.playlist_shuffle) |
1196 | playlist_shuffle(seed, -1); | 1197 | playlist_shuffle(seed, -1); |
1197 | 1198 | ||
1198 | /* Check if the file is at the same spot in the directory, | 1199 | /* Check if the file is at the same spot in the directory, |
1199 | else search for it */ | 1200 | else search for it */ |
1200 | if ((strcmp(strrchr(playlist_peek(index),'/') + 1, | 1201 | peek_filename = playlist_peek(index); |
1201 | filename))) | 1202 | |
1203 | if (peek_filename == NULL) | ||
1204 | return; | ||
1205 | |||
1206 | if (strcmp(strrchr(peek_filename, '/') + 1, filename)) | ||
1202 | { | 1207 | { |
1203 | for ( i=0; i < playlist_amount(); i++ ) | 1208 | for ( i=0; i < playlist_amount(); i++ ) |
1204 | { | 1209 | { |
1205 | if ((strcmp(strrchr(playlist_peek(i),'/') + 1, | 1210 | peek_filename = playlist_peek(i); |
1206 | filename)) == 0) | 1211 | |
1212 | if (peek_filename == NULL) | ||
1213 | return; | ||
1214 | |||
1215 | if (!strcmp(strrchr(peek_filename, '/') + 1, filename)) | ||
1207 | break; | 1216 | break; |
1208 | } | 1217 | } |
1209 | if (i < playlist_amount()) | 1218 | if (i < playlist_amount()) |