From 422ea20cefd4eb9fa95d283f50049f45dbf10e84 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Sun, 4 Jun 2023 00:43:56 +0200 Subject: Warn before overwriting another playlist on disk When saving a playlist to an existing file on disk, warn user, unless the playlist's file name remains unchanged. Change-Id: I10d82667de5fadb5323be4f981bea9263849f07a --- apps/menus/playlist_menu.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'apps/menus/playlist_menu.c') diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c index 9db87aa7a5..0983f9c338 100644 --- a/apps/menus/playlist_menu.c +++ b/apps/menus/playlist_menu.c @@ -65,18 +65,10 @@ int save_playlist_screen(struct playlist_info* playlist) strlcat(temp, DEFAULT_DYNAMIC_PLAYLIST_NAME, sizeof(temp)); } - dot = strrchr(temp, '.'); - if (dot) /* remove extension */ - *dot = '\0'; - - if (!kbd_input(temp, sizeof(temp), NULL)) + if (catalog_pick_new_playlist_name(temp, sizeof(temp), + playlist ? playlist->filename : + playlist_get_current()->filename)) { - len = strlen(temp); - if(len > 4 && !strcasecmp(&temp[len-4], ".m3u")) - strlcat(temp, "8", sizeof(temp)); - else if(len <= 5 || strcasecmp(&temp[len-5], ".m3u8")) - strlcat(temp, ".m3u8", sizeof(temp)); - playlist_save(playlist, temp, NULL, 0); /* reload in case playlist was saved to cwd */ -- cgit v1.2.3