From 97ab3673796527c4c8fd5c601573af07fd5ecd15 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Mon, 30 Sep 2019 17:58:30 -0400 Subject: [PATCH] Use dirent d_type when available instead of accessing FsDirectoryEntry. --- common/menu-list.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/common/menu-list.c b/common/menu-list.c index 61227bc..3013f89 100644 --- a/common/menu-list.c +++ b/common/menu-list.c @@ -176,11 +176,10 @@ int menuScan(const char* target) { memset(tmp_path, 0, sizeof(tmp_path)); snprintf(tmp_path, sizeof(tmp_path)-1, "%s%s%s", s_menu[!s_curMenu].dirname, dirsep, dp->d_name); - #ifdef __SWITCH__ - fsdev_dir_t* dirSt = (fsdev_dir_t*)dir->dirData->dirStruct; - FsDirectoryEntry* entry = &dirSt->entry_data[dirSt->index]; - - entrytype = entry->type == ENTRYTYPE_DIR; + #ifdef _DIRENT_HAVE_D_TYPE + if (dp->d_type == DT_UNKNOWN) + continue; + entrytype = dp->d_type != DT_REG; #else struct stat tmpstat;