diff options
Diffstat (limited to 'apps/menus/playlist_menu.c')
-rw-r--r-- | apps/menus/playlist_menu.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c index 2de73415b2..c0a0d48d45 100644 --- a/apps/menus/playlist_menu.c +++ b/apps/menus/playlist_menu.c | |||
@@ -42,25 +42,30 @@ int save_playlist_screen(struct playlist_info* playlist) | |||
42 | { | 42 | { |
43 | char temp[MAX_PATH+1], *dot; | 43 | char temp[MAX_PATH+1], *dot; |
44 | int len; | 44 | int len; |
45 | 45 | ||
46 | playlist_get_name(playlist, temp, sizeof(temp)-1); | 46 | playlist_get_name(playlist, temp, sizeof(temp)-1); |
47 | len = strlen(temp); | ||
48 | 47 | ||
48 | len = strlen(temp); | ||
49 | dot = strrchr(temp, '.'); | 49 | dot = strrchr(temp, '.'); |
50 | if (!dot) | 50 | |
51 | if (!dot && len <= 1) | ||
51 | { | 52 | { |
52 | /* folder of some type */ | 53 | snprintf(temp, sizeof(temp), "%s%s", |
53 | if (len > 1) | 54 | catalog_get_directory(), DEFAULT_DYNAMIC_PLAYLIST_NAME); |
54 | strcpy(&temp[len-1], ".m3u8"); | ||
55 | else | ||
56 | snprintf(temp, sizeof(temp), "%s%s", | ||
57 | catalog_get_directory(), DEFAULT_DYNAMIC_PLAYLIST_NAME); | ||
58 | } | 55 | } |
59 | else if (len > 4 && !strcasecmp(dot, ".m3u")) | 56 | |
60 | strcat(temp, "8"); | 57 | dot = strrchr(temp, '.'); |
58 | if (dot) /* remove extension */ | ||
59 | *dot = '\0'; | ||
61 | 60 | ||
62 | if (!kbd_input(temp, sizeof(temp))) | 61 | if (!kbd_input(temp, sizeof(temp))) |
63 | { | 62 | { |
63 | len = strlen(temp); | ||
64 | if(len > 4 && !strcasecmp(&temp[len-4], ".m3u")) | ||
65 | strlcat(temp, "8", sizeof(temp)); | ||
66 | else if(len <= 5 || strcasecmp(&temp[len-5], ".m3u8")) | ||
67 | strlcat(temp, ".m3u8", sizeof(temp)); | ||
68 | |||
64 | playlist_save(playlist, temp, NULL, 0); | 69 | playlist_save(playlist, temp, NULL, 0); |
65 | 70 | ||
66 | /* reload in case playlist was saved to cwd */ | 71 | /* reload in case playlist was saved to cwd */ |