Accept any file ending in IsFileSupported. It is

no longer limited to file type extension known from
DOS/Windows operating system.
This commit is contained in:
Erik Kunze 2021-09-15 19:31:12 +02:00
parent 9048d5fe57
commit a349af207d
2 changed files with 8 additions and 8 deletions

View File

@ -55,7 +55,7 @@ ios := 249
#---------------------------------------------------------------------------------
FALSE_POSITIVES := -Wno-array-bounds -Wno-stringop-overflow -Wno-stringop-overread
CFLAGS = -g -ggdb -O2 -Wall -Wno-multichar -Wno-address-of-packed-member -Wextra $(FALSE_POSITIVES) $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE -DHAVE_CONFIG_H
CXXFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS) -std=c++20
LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80620000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,wiiuse_register
ifeq ($(GITHUB_ACTIONS),true)

View File

@ -253,7 +253,7 @@ static void Add_Plugin_Game(char *FullPath)
{
/* Get roms's title without the extra ()'s or []'s */
string ShortName = m_plugin.GetRomName(FullPath);
//gprintf("shortName=%s\n", ShortName.c_str());
//gprintf("fullName=%s, shortName=%s\n", FullPath, ShortName.c_str());
/* only add disc 1 of multi disc games */
const char *RomFilename = strrchr(FullPath, '/') + 1;
@ -466,9 +466,11 @@ void ListGenerator::CreateList(u32 Flow, const string& Path, const vector<string
static inline bool IsFileSupported(const char *File, const vector<string>& FileTypes)
{
for(vector<string>::const_iterator cmp = FileTypes.begin(); cmp != FileTypes.end(); ++cmp)
auto fileName = std::string(File);
for (auto & fileType : FileTypes)
{
if(strcasecmp(File, cmp->c_str()) == 0)
if (fileName.length() >= fileType.length() &&
fileName.ends_with(fileType))
return true;
}
return false;
@ -503,9 +505,7 @@ void GetFiles(const char *Path, const vector<string>& FileTypes,
}
else if(pent->d_type == DT_REG)
{
NewFileName = strrchr(pent->d_name, '.');//the extension
if(NewFileName == NULL) NewFileName = pent->d_name;
if(IsFileSupported(NewFileName, FileTypes))
if(IsFileSupported(pent->d_name, FileTypes))
{
AddFile(FullPathChar);
continue;
@ -547,4 +547,4 @@ void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const stri
Asciify(ListElement.title);
m_cacheList.push_back(ListElement);
}
}
}