3
0
Fork 0
forked from suyu/suyu

Merge pull request #1871 from LFsWang/prevent-load-warn-msg

AddFstEntriesToGameList - prevent loading a directory as a file
This commit is contained in:
bunnei 2016-06-01 21:19:16 -04:00
commit 63557e3fc1

View file

@ -130,9 +130,7 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
if (stop_processing)
return false; // Breaks the callback loop.
if (recursion > 0 && FileUtil::IsDirectory(physical_name)) {
AddFstEntriesToGameList(physical_name, recursion - 1);
} else {
if (!FileUtil::IsDirectory(physical_name)) {
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
if (!loader)
return true;
@ -145,6 +143,8 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
new GameListItem(QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
new GameListItemSize(FileUtil::GetSize(physical_name)),
});
} else if (recursion > 0) {
AddFstEntriesToGameList(physical_name, recursion - 1);
}
return true;