summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2023-06-04 00:44:35 +0200
committerChristian Soffke <christian.soffke@gmail.com>2023-09-21 04:55:25 +0200
commit8f3cb75df0955eef3a4413d077ce764dd40f4eba (patch)
treefdc8861240fce2422bc3542a52064745892b992f
parente43c703480b4f1686abddf23537360acb723bb5e (diff)
downloadrockbox-8f3cb75df0.tar.gz
rockbox-8f3cb75df0.zip
Delete bookmarks when replacing unrelated playlist
After saving a playlist to an existing file with a different name, any saved bookmarks for the old playlist were still displayed for the new one. Change-Id: Ic2666bdaf7ec6e25456283fc15760c568dd7ac38
-rw-r--r--apps/playlist_catalog.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c
index be992645ee..f91f8c07bb 100644
--- a/apps/playlist_catalog.c
+++ b/apps/playlist_catalog.c
@@ -411,6 +411,7 @@ static int remove_extension(char* path)
bool catalog_pick_new_playlist_name(char *pl_name, size_t buf_size,
const char* curr_pl_name)
{
+ char bmark_file[MAX_PATH + 7];
bool do_save = false;
while (!do_save && !remove_extension(pl_name) &&
!kbd_input(pl_name, buf_size - 7, NULL))
@@ -421,7 +422,16 @@ bool catalog_pick_new_playlist_name(char *pl_name, size_t buf_size,
/* warn before overwriting existing (different) playlist */
if ((!curr_pl_name || strcmp(curr_pl_name, pl_name)) &&
file_exists(pl_name))
+ {
do_save = confirm_overwrite_yesno() == YESNO_YES;
+
+ if (do_save) /* delete bookmark file unrelated to new playlist */
+ {
+ snprintf(bmark_file, sizeof(bmark_file), "%s.bmark", pl_name);
+ if (file_exists(bmark_file))
+ remove(bmark_file);
+ }
+ }
}
return do_save;
}