From 30c4591b629bb96e9ff99aca24d0e0e51cedbf23 Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 21 Jul 2021 21:32:53 +0000 Subject: Improved file selector on hardware. --- source/gui.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/gui.c b/source/gui.c index b8b5c75..375fc74 100644 --- a/source/gui.c +++ b/source/gui.c @@ -59,7 +59,7 @@ typedef struct static FSEL_File fsel[FSEL_MAX_FILES]; -char last_dir[FILENAME_MAX] = "/3DS/"; +char last_dir[FILENAME_MAX] = "sdmc:/"; static void CheckPath(char *path) @@ -176,13 +176,12 @@ static int LoadDir(const char *path, const char *filter) { DIR *dir; struct dirent *ent; - struct stat st; int no = 0; char whole_path[FILENAME_MAX]; if ((dir = opendir(path))) { - if (strcmp(path, "/") != 0) + if (strcmp(path, "sdmc:/") != 0) { strcpy(fsel[no].name, ".."); fsel[no].is_dir = TRUE; @@ -196,13 +195,11 @@ static int LoadDir(const char *path, const char *filter) strcat(whole_path, "/"); strcat(whole_path, ent->d_name); - stat(whole_path, &st); - - if (ValidFilename(ent->d_name, (st.st_mode & S_IFDIR), filter)) + if (ValidFilename(ent->d_name, ent->d_type & DT_DIR, filter)) { strcpy(fsel[no].name,ent->d_name); - fsel[no].is_dir = (st.st_mode & S_IFDIR); - fsel[no].size = (int)st.st_size; + fsel[no].is_dir = ent->d_type & DT_DIR; + fsel[no].size = 0; no++; } } -- cgit v1.2.3