summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 7f0bf4362b..0e4a1962bc 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -190,15 +190,27 @@ static int showdir(char *path, int start)
190 if (!entry) 190 if (!entry)
191 break; 191 break;
192 192
193 len = strlen(entry->d_name);
194
193 /* skip directories . and .. */ 195 /* skip directories . and .. */
194 if ((entry->attribute & ATTR_DIRECTORY) && 196 if ((entry->attribute & ATTR_DIRECTORY) &&
195 (!strncmp(entry->d_name, ".", 1) || 197 (((len == 1) &&
196 !strncmp(entry->d_name, "..", 2))) { 198 (!strncmp(entry->d_name, ".", 1))) ||
199 ((len == 2) &&
200 (!strncmp(entry->d_name, "..", 2))))) {
201 i--;
202 continue;
203 }
204
205 /* Skip dotfiles if set to skip them */
206 if (!global_settings.show_hidden_files &&
207 ((entry->d_name[0]=='.') ||
208 (entry->attribute & ATTR_HIDDEN))) {
197 i--; 209 i--;
198 continue; 210 continue;
199 } 211 }
212
200 dptr->attr = entry->attribute; 213 dptr->attr = entry->attribute;
201 len = strlen(entry->d_name);
202 214
203 /* mark mp3 and m3u files as such */ 215 /* mark mp3 and m3u files as such */
204 if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) ) { 216 if ( !(dptr->attr & ATTR_DIRECTORY) && (len > 4) ) {
@@ -209,10 +221,10 @@ static int showdir(char *path, int start)
209 dptr->attr |= TREE_ATTR_M3U; 221 dptr->attr |= TREE_ATTR_M3U;
210 } 222 }
211 223
212 /* filter hidden files and directories and non-mp3 or m3u files */ 224 /* filter non-mp3 or m3u files */
213 if ( global_settings.mp3filter && 225 if ( global_settings.mp3filter &&
214 ((dptr->attr & ATTR_HIDDEN) || 226 (!(dptr->attr &
215 !(dptr->attr & (ATTR_DIRECTORY|TREE_ATTR_MP3|TREE_ATTR_M3U))) ) { 227 (ATTR_DIRECTORY|TREE_ATTR_MP3|TREE_ATTR_M3U))) ) {
216 i--; 228 i--;
217 continue; 229 continue;
218 } 230 }
@@ -627,13 +639,23 @@ bool dirbrowse(char *root)
627 case TREE_MENU: { 639 case TREE_MENU: {
628 bool lastfilter = global_settings.mp3filter; 640 bool lastfilter = global_settings.mp3filter;
629 bool lastsortcase = global_settings.sort_case; 641 bool lastsortcase = global_settings.sort_case;
642 bool show_hidden_files = global_settings.show_hidden_files;
643
644#ifdef HAVE_LCD_BITMAP
645 bool laststate=statusbar(false);
646#endif
647
630 lcd_stop_scroll(); 648 lcd_stop_scroll();
631 main_menu(); 649 main_menu();
632 /* do we need to rescan dir? */ 650 /* do we need to rescan dir? */
633 if ( lastfilter != global_settings.mp3filter || 651 if ( lastfilter != global_settings.mp3filter ||
634 lastsortcase != global_settings.sort_case) 652 lastsortcase != global_settings.sort_case ||
653 show_hidden_files != global_settings.show_hidden_files)
635 lastdir[0] = 0; 654 lastdir[0] = 0;
636 restore = true; 655 restore = true;
656#ifdef HAVE_LCD_BITMAP
657 statusbar(laststate);
658#endif
637 break; 659 break;
638 } 660 }
639 661