mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-20 06:45:15 +01:00
list games only once if same game has multiple accepted extensions
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
287b1bb048
commit
2ee2c2e5f3
@ -372,8 +372,9 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info, std::string me
|
|||||||
|
|
||||||
void CollectionInfoBuilder::addPlaylists(CollectionInfo *info)
|
void CollectionInfoBuilder::addPlaylists(CollectionInfo *info)
|
||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct dirent *dirp;
|
struct dirent **dirp;
|
||||||
|
int n;
|
||||||
std::string path = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists");
|
std::string path = Utils::combinePath(Configuration::absolutePath, "collections", info->name, "playlists");
|
||||||
dp = opendir(path.c_str());
|
dp = opendir(path.c_str());
|
||||||
|
|
||||||
@ -383,9 +384,11 @@ void CollectionInfoBuilder::addPlaylists(CollectionInfo *info)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while((dirp = readdir(dp)) != NULL)
|
n = scandir(path.c_str(), &dirp, NULL, alphasort);
|
||||||
|
|
||||||
|
while(n-- > 0)
|
||||||
{
|
{
|
||||||
std::string file = dirp->d_name;
|
std::string file = dirp[n]->d_name;
|
||||||
|
|
||||||
size_t position = file.find_last_of(".");
|
size_t position = file.find_last_of(".");
|
||||||
std::string basename = (std::string::npos == position)? file : file.substr(0, position);
|
std::string basename = (std::string::npos == position)? file : file.substr(0, position);
|
||||||
@ -450,9 +453,10 @@ void CollectionInfoBuilder::ImportRomDirectory(std::string path, CollectionInfo
|
|||||||
|
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct dirent **dirp;
|
struct dirent **dirp;
|
||||||
|
int n;
|
||||||
std::vector<std::string> extensions;
|
std::vector<std::string> extensions;
|
||||||
std::vector<std::string>::iterator extensionsIt;
|
std::vector<std::string>::iterator extensionsIt;
|
||||||
int n;
|
std::string previous_basename;
|
||||||
|
|
||||||
info->extensionList(extensions);
|
info->extensionList(extensions);
|
||||||
|
|
||||||
@ -465,7 +469,6 @@ void CollectionInfoBuilder::ImportRomDirectory(std::string path, CollectionInfo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("ImportRomDirectory\n");
|
|
||||||
n = scandir(path.c_str(), &dirp, NULL, alphasort);
|
n = scandir(path.c_str(), &dirp, NULL, alphasort);
|
||||||
|
|
||||||
while(dp != NULL && n-- > 0)
|
while(dp != NULL && n-- > 0)
|
||||||
@ -483,8 +486,6 @@ void CollectionInfoBuilder::ImportRomDirectory(std::string path, CollectionInfo
|
|||||||
size_t position = file.find_last_of(".");
|
size_t position = file.find_last_of(".");
|
||||||
std::string basename = (std::string::npos == position)? file : file.substr(0, position);
|
std::string basename = (std::string::npos == position)? file : file.substr(0, position);
|
||||||
|
|
||||||
printf(" File: %s, basename :%s\n", file.c_str(), basename.c_str());
|
|
||||||
|
|
||||||
// if there is an include list, only include roms that are found and are in the include list
|
// if there is an include list, only include roms that are found and are in the include list
|
||||||
// if there is an exclude list, exclude those roms
|
// if there is an exclude list, exclude those roms
|
||||||
if ((includeFilter.size() == 0 || (includeFilter.find(basename) != includeFilter.end())) &&
|
if ((includeFilter.size() == 0 || (includeFilter.find(basename) != includeFilter.end())) &&
|
||||||
@ -498,8 +499,11 @@ void CollectionInfoBuilder::ImportRomDirectory(std::string path, CollectionInfo
|
|||||||
|
|
||||||
if (start >= 0)
|
if (start >= 0)
|
||||||
{
|
{
|
||||||
if (file.compare(start, comparator.length(), *extensionsIt) == 0)
|
if (file.compare(start, comparator.length(), *extensionsIt) == 0 &&
|
||||||
|
basename.compare(previous_basename) != 0)
|
||||||
{
|
{
|
||||||
|
previous_basename = basename;
|
||||||
|
|
||||||
Item *i = new Item();
|
Item *i = new Item();
|
||||||
|
|
||||||
i->name = basename;
|
i->name = basename;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user