diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2023-06-04 00:44:35 +0200 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2023-09-21 04:55:25 +0200 |
commit | 8f3cb75df0955eef3a4413d077ce764dd40f4eba (patch) | |
tree | fdc8861240fce2422bc3542a52064745892b992f | |
parent | e43c703480b4f1686abddf23537360acb723bb5e (diff) | |
download | rockbox-8f3cb75df0955eef3a4413d077ce764dd40f4eba.tar.gz rockbox-8f3cb75df0955eef3a4413d077ce764dd40f4eba.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.c | 10 |
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) | |||
411 | bool catalog_pick_new_playlist_name(char *pl_name, size_t buf_size, | 411 | bool catalog_pick_new_playlist_name(char *pl_name, size_t buf_size, |
412 | const char* curr_pl_name) | 412 | const char* curr_pl_name) |
413 | { | 413 | { |
414 | char bmark_file[MAX_PATH + 7]; | ||
414 | bool do_save = false; | 415 | bool do_save = false; |
415 | while (!do_save && !remove_extension(pl_name) && | 416 | while (!do_save && !remove_extension(pl_name) && |
416 | !kbd_input(pl_name, buf_size - 7, NULL)) | 417 | !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, | |||
421 | /* warn before overwriting existing (different) playlist */ | 422 | /* warn before overwriting existing (different) playlist */ |
422 | if ((!curr_pl_name || strcmp(curr_pl_name, pl_name)) && | 423 | if ((!curr_pl_name || strcmp(curr_pl_name, pl_name)) && |
423 | file_exists(pl_name)) | 424 | file_exists(pl_name)) |
425 | { | ||
424 | do_save = confirm_overwrite_yesno() == YESNO_YES; | 426 | do_save = confirm_overwrite_yesno() == YESNO_YES; |
427 | |||
428 | if (do_save) /* delete bookmark file unrelated to new playlist */ | ||
429 | { | ||
430 | snprintf(bmark_file, sizeof(bmark_file), "%s.bmark", pl_name); | ||
431 | if (file_exists(bmark_file)) | ||
432 | remove(bmark_file); | ||
433 | } | ||
434 | } | ||
425 | } | 435 | } |
426 | return do_save; | 436 | return do_save; |
427 | } | 437 | } |