From 8f3cb75df0955eef3a4413d077ce764dd40f4eba Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sun, 4 Jun 2023 00:44:35 +0200 Subject: 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 --- apps/playlist_catalog.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'apps') 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; } -- cgit v1.2.3