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
This commit is contained in:
Christian Soffke 2023-06-04 00:44:35 +02:00
parent e43c703480
commit 8f3cb75df0

View file

@ -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;
}