From a9c9d7a93f866f0e633ebb398be328447b3bfd5e Mon Sep 17 00:00:00 2001 From: d0k3 Date: Thu, 8 Dec 2016 23:36:03 +0100 Subject: [PATCH] Improve image mount path selection --- source/godmode.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/godmode.c b/source/godmode.c index 41e44ba..2d20398 100644 --- a/source/godmode.c +++ b/source/godmode.c @@ -752,11 +752,17 @@ u32 GodMode() { ShowPrompt(false, "Mounting image: failed"); InitImgFS(NULL); } else { + cursor = 0; *current_path = '\0'; GetDirContents(current_dir, current_path); - cursor = 0; - for (u32 i = current_dir->n_entries - 1; i > 0; i--) - if (strspn(current_dir->entry[i].path, "789GI") > 0) cursor = i; + for (u32 i = 0; i < current_dir->n_entries; i++) { + if (strspn(current_dir->entry[i].path, "789GI") == 0) + continue; + strncpy(current_path, current_dir->entry[i].path, 256); + GetDirContents(current_dir, current_path); + cursor = 1; + break; + } } } else if (user_select == searchdrv) { // -> search drive, open containing path char* last_slash = strrchr(curr_entry->path, '/');