mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-12-15 15:25:31 +00:00
yuzu/game_list_worker: Move std::string construction after the termination check in callbacks
Avoids potentially allocating a std::string instance when it isn't needed.
This commit is contained in:
parent
8c108eaca7
commit
a49fd7fd57
|
@ -163,13 +163,12 @@ void GameListWorker::AddInstalledTitlesToGameList() {
|
||||||
void GameListWorker::FillControlMap(const std::string& dir_path) {
|
void GameListWorker::FillControlMap(const std::string& dir_path) {
|
||||||
const auto nca_control_callback = [this](u64* num_entries_out, const std::string& directory,
|
const auto nca_control_callback = [this](u64* num_entries_out, const std::string& directory,
|
||||||
const std::string& virtual_name) -> bool {
|
const std::string& virtual_name) -> bool {
|
||||||
const std::string physical_name = directory + DIR_SEP + virtual_name;
|
|
||||||
|
|
||||||
if (stop_processing) {
|
if (stop_processing) {
|
||||||
// Breaks the callback loop
|
// Breaks the callback loop
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string physical_name = directory + DIR_SEP + virtual_name;
|
||||||
const QFileInfo file_info(QString::fromStdString(physical_name));
|
const QFileInfo file_info(QString::fromStdString(physical_name));
|
||||||
if (!file_info.isDir() && file_info.suffix() == QStringLiteral("nca")) {
|
if (!file_info.isDir() && file_info.suffix() == QStringLiteral("nca")) {
|
||||||
auto nca =
|
auto nca =
|
||||||
|
@ -188,12 +187,13 @@ void GameListWorker::FillControlMap(const std::string& dir_path) {
|
||||||
void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) {
|
void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) {
|
||||||
const auto callback = [this, recursion](u64* num_entries_out, const std::string& directory,
|
const auto callback = [this, recursion](u64* num_entries_out, 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 &&
|
if (!is_dir &&
|
||||||
(HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) {
|
(HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) {
|
||||||
std::unique_ptr<Loader::AppLoader> loader =
|
std::unique_ptr<Loader::AppLoader> loader =
|
||||||
|
|
Loading…
Reference in a new issue