mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-24 20:35:01 +00:00
27 lines
No EOL
923 B
C++
27 lines
No EOL
923 B
C++
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include <future>
|
|
#include <thread>
|
|
#include "game_info.h"
|
|
|
|
void GameInfoClass::GetGameInfo() {
|
|
QString installDir = m_gui_settings->GetValue(gui::settings_install_dir).toString();
|
|
std::filesystem::path parent_folder(installDir.toStdString());
|
|
std::vector<std::string> filePaths;
|
|
for (const auto& dir : std::filesystem::directory_iterator(parent_folder)) {
|
|
if (dir.is_directory()) {
|
|
filePaths.push_back(dir.path().string());
|
|
}
|
|
}
|
|
std::vector<std::future<GameInfo>> futures;
|
|
|
|
for (const auto& filePath : filePaths) {
|
|
futures.emplace_back(std::async(std::launch::async, readGameInfo, filePath));
|
|
}
|
|
|
|
for (auto& future : futures) {
|
|
m_games.push_back(future.get());
|
|
}
|
|
std::sort(m_games.begin(), m_games.end(), CompareStrings);
|
|
} |