mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-02-25 02:33:10 +01:00
use sorted scandir instead of readdir
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
5bb70b02eb
commit
287b1bb048
@ -449,9 +449,10 @@ void CollectionInfoBuilder::ImportRomDirectory(std::string path, CollectionInfo
|
|||||||
{
|
{
|
||||||
|
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct dirent *dirp;
|
struct dirent **dirp;
|
||||||
std::vector<std::string> extensions;
|
std::vector<std::string> extensions;
|
||||||
std::vector<std::string>::iterator extensionsIt;
|
std::vector<std::string>::iterator extensionsIt;
|
||||||
|
int n;
|
||||||
|
|
||||||
info->extensionList(extensions);
|
info->extensionList(extensions);
|
||||||
|
|
||||||
@ -464,9 +465,12 @@ void CollectionInfoBuilder::ImportRomDirectory(std::string path, CollectionInfo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(dp != NULL && (dirp = readdir(dp)) != NULL)
|
printf("ImportRomDirectory\n");
|
||||||
|
n = scandir(path.c_str(), &dirp, NULL, alphasort);
|
||||||
|
|
||||||
|
while(dp != NULL && n-- > 0)
|
||||||
{
|
{
|
||||||
std::string file = dirp->d_name;
|
std::string file = dirp[n]->d_name;
|
||||||
|
|
||||||
// Check if the file is a directory or a file
|
// Check if the file is a directory or a file
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
@ -479,6 +483,8 @@ 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())) &&
|
||||||
|
|||||||
@ -705,9 +705,7 @@ void RetroFE::run( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentPage_->onNewItemSelected( );
|
currentPage_->onNewItemSelected( );
|
||||||
printf("\nbefore currentPage_->reallocateMenuSpritePoints()\n");
|
|
||||||
currentPage_->reallocateMenuSpritePoints( );
|
currentPage_->reallocateMenuSpritePoints( );
|
||||||
printf("after currentPage_->reallocateMenuSpritePoints()\n\n");
|
|
||||||
|
|
||||||
state = RETROFE_NEXT_PAGE_MENU_LOAD_ART;
|
state = RETROFE_NEXT_PAGE_MENU_LOAD_ART;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user