mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-29 15:04:23 +01:00
Cleanup file extension code
This commit is contained in:
parent
4236bd59e2
commit
4c440d304e
21
Src/menu.cpp
21
Src/menu.cpp
@ -222,6 +222,17 @@ static bool ext_matches(const char *name, const char *ext)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ext_matches_list(const char *name, const char **exts)
|
||||||
|
{
|
||||||
|
for (const char **p = exts; *p; p++)
|
||||||
|
{
|
||||||
|
if (ext_matches(name, *p))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static const char **get_file_list(const char *base_dir)
|
static const char **get_file_list(const char *base_dir)
|
||||||
{
|
{
|
||||||
DIR *d = opendir(base_dir);
|
DIR *d = opendir(base_dir);
|
||||||
@ -241,12 +252,10 @@ static const char **get_file_list(const char *base_dir)
|
|||||||
de;
|
de;
|
||||||
de = readdir(d))
|
de = readdir(d))
|
||||||
{
|
{
|
||||||
if (ext_matches(de->d_name, ".d64") || ext_matches(de->d_name, ".D64") ||
|
const char *exts[] = {".d64", ".D64", ".prg", ".PRG",
|
||||||
ext_matches(de->d_name, ".prg") || ext_matches(de->d_name, ".PRG") ||
|
".p00", ".P00", ".s00", ".S00",
|
||||||
ext_matches(de->d_name, ".p00") || ext_matches(de->d_name, ".P00") ||
|
".t64", ".T64", ".sav", ".SAV"};
|
||||||
ext_matches(de->d_name, ".s00") || ext_matches(de->d_name, ".S00") ||
|
if (ext_matches_list(de->d_name, exts))
|
||||||
ext_matches(de->d_name, ".t64") || ext_matches(de->d_name, ".T64") ||
|
|
||||||
ext_matches(de->d_name, ".sav"))
|
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user