From 6a865f2430da9e20ee4150df6260fe7af3159f4a Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Fri, 3 Jan 2025 17:04:43 +0100 Subject: [PATCH] Playlist Viewer: Delete playlist when emptied When you removed all tracks from an on-disk playlist, you were asked whether you wanted to save it, which would fail, but did not show any accompanying message. Instead of trying to save the playlist, after getting the confirmation, delete the playlist file from disk. Change-Id: Iad54f2f490b15dd9c8a8fdfb8f12e58fd17d5e36 --- apps/playlist_viewer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index ace45f03ce..13d8c609d7 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -638,8 +638,14 @@ static void close_playlist_viewer(void) if (viewer.initial_selection) *(viewer.initial_selection) = viewer.selected_track; - if(playlist_modified(viewer.playlist) && yesno_pop(ID2P(LANG_SAVE_CHANGES))) - save_playlist_screen(viewer.playlist); + if(playlist_modified(viewer.playlist)) + { + if (viewer.num_tracks && yesno_pop(ID2P(LANG_SAVE_CHANGES))) + save_playlist_screen(viewer.playlist); + else if (!viewer.num_tracks && + confirm_delete_yesno(viewer.playlist->filename) == YESNO_YES) + remove(viewer.playlist->filename); + } playlist_close(viewer.playlist); } }