summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2025-01-03 17:04:43 +0100
committerChristian Soffke <christian.soffke@gmail.com>2025-01-05 14:39:24 -0500
commit6a865f2430da9e20ee4150df6260fe7af3159f4a (patch)
tree42ba9b367809bd66243f81b8b05080ec4ea5936b
parent0012411fc59566395a5dc8ba083a2327e03f5bc0 (diff)
downloadrockbox-6a865f2430.tar.gz
rockbox-6a865f2430.zip
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
-rw-r--r--apps/playlist_viewer.c10
1 files 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);
}
}