2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

yuzu/game_list_worker: Tidy up string handling in FillControlMap()

We don't need to call out to our own file handling functions when we're
going to construct a QFileInfo instance right after it. We also don't
need to convert to a std::string again just to compare the file
extension.
This commit is contained in:
Lioncash 2018-12-01 22:48:57 -05:00
parent e88cdcc912
commit f1ecfcb8bc

View file

@ -155,14 +155,15 @@ 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 {
std::string physical_name = directory + DIR_SEP + virtual_name; const std::string physical_name = directory + DIR_SEP + virtual_name;
if (stop_processing) if (stop_processing) {
return false; // Breaks the callback loop. // Breaks the callback loop
return false;
}
bool is_dir = FileUtil::IsDirectory(physical_name); const QFileInfo file_info(QString::fromStdString(physical_name));
QFileInfo file_info(physical_name.c_str()); if (!file_info.isDir() && file_info.suffix() == QStringLiteral("nca")) {
if (!is_dir && file_info.suffix().toStdString() == "nca") {
auto nca = auto nca =
std::make_unique<FileSys::NCA>(vfs->OpenFile(physical_name, FileSys::Mode::Read)); std::make_unique<FileSys::NCA>(vfs->OpenFile(physical_name, FileSys::Mode::Read));
if (nca->GetType() == FileSys::NCAContentType::Control) { if (nca->GetType() == FileSys::NCAContentType::Control) {