summaryrefslogtreecommitdiff
path: root/apps/filetree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/filetree.c')
-rw-r--r--apps/filetree.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index 107163add5..2d4416df5a 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -72,6 +72,7 @@ static int strnatcasecmp_n(const char *a, const char *b, size_t n)
72int ft_build_playlist(struct tree_context* c, int start_index) 72int ft_build_playlist(struct tree_context* c, int start_index)
73{ 73{
74 int i; 74 int i;
75 int res = 0;
75 int start=start_index; 76 int start=start_index;
76 77
77 tree_lock_cache(c); 78 tree_lock_cache(c);
@@ -81,7 +82,8 @@ int ft_build_playlist(struct tree_context* c, int start_index)
81 { 82 {
82 if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) 83 if((entries[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO)
83 { 84 {
84 if (playlist_add(entries[i].name) < 0) 85 res = playlist_add(entries[i].name);
86 if (res < 0)
85 break; 87 break;
86 } 88 }
87 else 89 else
@@ -92,7 +94,22 @@ int ft_build_playlist(struct tree_context* c, int start_index)
92 } 94 }
93 } 95 }
94 96
95 tree_unlock_cache(c); 97 if (res == -2) /* name buffer is full store to disk? */
98 {
99 if (yesno_pop(ID2P(LANG_CATALOG_ADD_TO_NEW)))
100 {
101 char playlist_dir[MAX_PATH];
102 strmemccpy(playlist_dir, c->currdir, sizeof(playlist_dir));
103 tree_unlock_cache(c);
104 if (playlist_create(playlist_dir, "dynamic.m3u8") >= 0)
105 {
106 playlist_insert_directory(NULL, playlist_dir,
107 PLAYLIST_REPLACE, false, false);
108 }
109 }
110 }
111 else
112 tree_unlock_cache(c);
96 113
97 return start_index; 114 return start_index;
98} 115}