summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2021-07-21 21:32:53 +0000
committerIan C <ianc@noddybox.co.uk>2021-07-21 21:32:53 +0000
commit30c4591b629bb96e9ff99aca24d0e0e51cedbf23 (patch)
tree2b45fef718094822162a43ef8500ddf0294e9db1 /source
parent788e914d7e259b42a9b58c667e2e4d8931b86fdd (diff)
Improved file selector on hardware.
Diffstat (limited to 'source')
-rw-r--r--source/gui.c13
1 files changed, 5 insertions, 8 deletions
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++;
}
}