Merge pull request #101 from MP2E/minor_cleanup

only check for ".." filepath once
This commit is contained in:
sorgelig
2019-08-03 06:23:21 +08:00
committed by GitHub

View File

@@ -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))
{