From 3fe86a76b12a3ef81d32bd676dd4af46955269c9 Mon Sep 17 00:00:00 2001 From: Cray Elliott Date: Thu, 1 Aug 2019 16:27:17 -0700 Subject: [PATCH] only check for ".." filepath once --- file_io.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/file_io.cpp b/file_io.cpp index d942dfa..fd55134 100644 --- a/file_io.cpp +++ b/file_io.cpp @@ -1063,12 +1063,15 @@ int ScanDirectory(char* path, int mode, const char *extension, int options, cons if (options & SCANO_NEOGEO) { if (de->d_type != DT_DIR) continue; - // skip hidden folders - if (!strncasecmp(de->d_name, ".", 1) && strcmp(de->d_name, "..")) continue; if (!strcmp(de->d_name, "..")) { if (!strlen(path)) continue; } + else + { + // skip hidden folders + if (!strncasecmp(de->d_name, ".", 1)) continue; + } direntext_t dext = { *de, 0, "" }; memcpy(dext.altname, de->d_name, sizeof(dext.altname)); @@ -1087,14 +1090,17 @@ int ScanDirectory(char* path, int mode, const char *extension, int options, cons { if (de->d_type == DT_DIR) { - // skip hidden folder - if (!strncasecmp(de->d_name, ".", 1) && strcmp(de->d_name, "..")) continue; // skip System Volume Information folder if (!strcmp(de->d_name, "System Volume Information")) continue; if (!strcmp(de->d_name, "..")) { if (!strlen(path)) continue; } + else + { + // skip hidden folder + if (!strncasecmp(de->d_name, ".", 1)) continue; + } if (!(options & SCANO_DIR)) {