isExtensionMatching is case insensitive, but not further checks, making those whole function case sensitive, which it should not

This commit is contained in:
3djc
2017-02-18 11:00:13 +01:00
parent 299c5924fa
commit e4c3326c0a
+4 -5
View File
@@ -231,7 +231,7 @@ bool sdListFiles(const char * path, const char * extension, const uint8_t maxlen
#if defined(CPUARM)
popupMenuOffsetType = MENU_OFFSET_EXTERNAL;
#endif
#if defined(CPUARM)
static uint8_t s_last_flags;
@@ -294,15 +294,14 @@ bool sdListFiles(const char * path, const char * extension, const uint8_t maxlen
// TRACE_DEBUG("listSdFiles(%s, %s, %u, %s, %u): fn='%s'; fnExt='%s'; match=%d\n",
// path, extension, maxlen, (selection ? selection : "nul"), flags, fno.fname, (fnExt ? fnExt : "nul"), (fnExt && isExtensionMatching(fnExt, extension)));
// file validation checks
if (!fnLen || fnLen > maxlen || ( // wrong size
fnExt && extension && ( // extension-based checks follow...
!isExtensionMatching(fnExt, extension) || ( // wrong extension
!(flags & LIST_SD_FILE_EXT) && // only if we want unique file names...
strcmp(fnExt, getFileExtension(extension)) && // possible duplicate file name...
strcasecmp(fnExt, getFileExtension(extension)) && // possible duplicate file name...
isFilePatternAvailable(path, fno.fname, extension, true, tmpExt) && // find the first file from extensions list...
strncmp(fnExt, tmpExt, LEN_FILE_EXTENSION_MAX) // found file doesn't match, this is a duplicate
strncasecmp(fnExt, tmpExt, LEN_FILE_EXTENSION_MAX) // found file doesn't match, this is a duplicate
)
)
))
@@ -384,7 +383,7 @@ bool isCwdAtRoot()
}
/*
Wrapper around the f_readdir() function which
Wrapper around the f_readdir() function which
also returns ".." entry for sub-dirs. (FatFS 0.12 does
not return ".", ".." dirs anymore)
*/