mirror of
https://github.com/Fledge68/WiiFlow_Lite.git
synced 2024-11-27 13:44:15 +01:00
Merge pull request #277 from eku/feature/accept_any_file_ending
Accept any file ending for filetypes
This commit is contained in:
commit
3b1fdf06bd
@ -55,7 +55,7 @@ ios := 249
|
|||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
FALSE_POSITIVES := -Wno-array-bounds -Wno-stringop-overflow -Wno-stringop-overread
|
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
|
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
|
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)
|
ifeq ($(GITHUB_ACTIONS),true)
|
||||||
|
@ -253,7 +253,7 @@ static void Add_Plugin_Game(char *FullPath)
|
|||||||
{
|
{
|
||||||
/* Get roms's title without the extra ()'s or []'s */
|
/* Get roms's title without the extra ()'s or []'s */
|
||||||
string ShortName = m_plugin.GetRomName(FullPath);
|
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 */
|
/* only add disc 1 of multi disc games */
|
||||||
const char *RomFilename = strrchr(FullPath, '/') + 1;
|
const char *RomFilename = strrchr(FullPath, '/') + 1;
|
||||||
@ -466,9 +466,18 @@ void ListGenerator::CreateList(u32 Flow, const string& Path, const vector<string
|
|||||||
|
|
||||||
static inline bool IsFileSupported(const char *File, const vector<string>& FileTypes)
|
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() &&
|
||||||
|
std::equal(fileName.end() - fileType.length(),
|
||||||
|
fileName.end(), fileType.begin(),
|
||||||
|
[](const char & c1, const char & c2)
|
||||||
|
{
|
||||||
|
return (c1 == c2 ||
|
||||||
|
std::toupper(c1) ==
|
||||||
|
std::toupper(c2));
|
||||||
|
}))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -503,9 +512,7 @@ void GetFiles(const char *Path, const vector<string>& FileTypes,
|
|||||||
}
|
}
|
||||||
else if(pent->d_type == DT_REG)
|
else if(pent->d_type == DT_REG)
|
||||||
{
|
{
|
||||||
NewFileName = strrchr(pent->d_name, '.');//the extension
|
if(IsFileSupported(pent->d_name, FileTypes))
|
||||||
if(NewFileName == NULL) NewFileName = pent->d_name;
|
|
||||||
if(IsFileSupported(NewFileName, FileTypes))
|
|
||||||
{
|
{
|
||||||
AddFile(FullPathChar);
|
AddFile(FullPathChar);
|
||||||
continue;
|
continue;
|
||||||
@ -547,4 +554,4 @@ void ListGenerator::createSFList(u8 maxBtns, Config &m_sourceMenuCfg, const stri
|
|||||||
Asciify(ListElement.title);
|
Asciify(ListElement.title);
|
||||||
m_cacheList.push_back(ListElement);
|
m_cacheList.push_back(ListElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user