mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-29 10:32:30 -06:00
yuzu/game_list_worker: Move std::string construction after the termintion check in callbacks
Avoids potentially allocating a std::string instance when it isn't needed.
This commit is contained in:
parent
5840943110
commit
5a625fe945
1 changed files with 6 additions and 5 deletions
|
@ -37,12 +37,13 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
|
||||||
const auto callback = [this, recursion, parent_dir](u64* num_entries_out,
|
const auto callback = [this, recursion, parent_dir](u64* num_entries_out,
|
||||||
const std::string& directory,
|
const std::string& directory,
|
||||||
const std::string& virtual_name) -> bool {
|
const std::string& virtual_name) -> bool {
|
||||||
std::string physical_name = directory + DIR_SEP + virtual_name;
|
if (stop_processing) {
|
||||||
|
// Breaks the callback loop.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (stop_processing)
|
const std::string physical_name = directory + DIR_SEP + virtual_name;
|
||||||
return false; // Breaks the callback loop.
|
const bool is_dir = FileUtil::IsDirectory(physical_name);
|
||||||
|
|
||||||
bool is_dir = FileUtil::IsDirectory(physical_name);
|
|
||||||
if (!is_dir && HasSupportedFileExtension(physical_name)) {
|
if (!is_dir && HasSupportedFileExtension(physical_name)) {
|
||||||
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
|
std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(physical_name);
|
||||||
if (!loader)
|
if (!loader)
|
||||||
|
|
Loading…
Reference in a new issue