Ignore directories when searching folders

This commit is contained in:
d0k3 2017-03-20 02:13:51 +01:00
parent 6a8b97c3e5
commit 3a22496705
3 changed files with 7 additions and 3 deletions

View File

@ -137,7 +137,8 @@ bool GetDirContentsWorker(DirStruct* contents, char* fpath, int fnsize, const ch
ret = true; // Too many entries, still okay
break;
}
contents->n_entries++;
if (!recursive || (entry->type != T_DIR))
contents->n_entries++;
}
if (recursive && (fno.fattrib & AM_DIR)) {
if (!GetDirContentsWorker(contents, fpath, fnsize, pattern, recursive))

View File

@ -1221,7 +1221,7 @@ u32 GodMode() {
// basic navigation commands
if ((pad_state & BUTTON_A) && (curr_entry->type != T_FILE) && (curr_entry->type != T_DOTDOT)) { // for dirs
if (switched && !(DriveType(curr_entry->path) & DRV_SEARCH)) { // search directory
const char* optionstr[2] = { "Search files & subdirs", "Directory info" }; // search files only?
const char* optionstr[2] = { "Search for files...", "Directory info" }; // search files only?
char namestr[32+1];
TruncateString(namestr, (*current_path) ? curr_entry->path : curr_entry->name, 32, 8);
u32 user_select = ShowSelectPrompt(2, optionstr, "%s", namestr);

View File

@ -144,7 +144,10 @@ bool GetVirtualDirContents(DirStruct* contents, char* fpath, int fnsize, const c
entry->size = vfile.size;
entry->type = (vfile.flags & VFLAG_DIR) ? T_DIR : T_FILE;
entry->marked = 0;
contents->n_entries++;
if (contents->n_entries >= MAX_DIR_ENTRIES)
break; // Too many entries, still okay
if (!recursive || (entry->type != T_DIR))
contents->n_entries++;
}
if (recursive && (vfile.flags & VFLAG_DIR)) {
if (!GetVirtualDirContents(contents, fpath, fnsize, pattern, recursive))