Merge pull request #4065 from zhaowenlan1779/port-yuzu-947

game_list: Use QString::fromStdString() where applicable instead of c_str()
This commit is contained in:
James Rowe 2018-08-09 09:41:35 -06:00 committed by GitHub
commit dceb4150a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -617,7 +617,7 @@ const QStringList GameList::supported_file_extensions = {"3ds", "3dsx", "elf", "
"cci", "cxi", "app"}; "cci", "cxi", "app"};
static bool HasSupportedFileExtension(const std::string& file_name) { static bool HasSupportedFileExtension(const std::string& file_name) {
QFileInfo file = QFileInfo(file_name.c_str()); QFileInfo file = QFileInfo(QString::fromStdString(file_name));
return GameList::supported_file_extensions.contains(file.suffix(), Qt::CaseInsensitive); return GameList::supported_file_extensions.contains(file.suffix(), Qt::CaseInsensitive);
} }
@ -708,7 +708,7 @@ void GameListWorker::run() {
stop_processing = false; stop_processing = false;
for (UISettings::GameDir& game_dir : game_dirs) { for (UISettings::GameDir& game_dir : game_dirs) {
if (game_dir.path == "INSTALLED") { if (game_dir.path == "INSTALLED") {
QString path = QString(FileUtil::GetUserPath(D_SDMC_IDX).c_str()) + QString path = QString::fromStdString(FileUtil::GetUserPath(D_SDMC_IDX)) +
"Nintendo " "Nintendo "
"3DS/00000000000000000000000000000000/" "3DS/00000000000000000000000000000000/"
"00000000000000000000000000000000/title/00040000"; "00000000000000000000000000000000/title/00040000";
@ -717,14 +717,12 @@ void GameListWorker::run() {
emit DirEntryReady({game_list_dir}); emit DirEntryReady({game_list_dir});
AddFstEntriesToGameList(path.toStdString(), 2, game_list_dir); AddFstEntriesToGameList(path.toStdString(), 2, game_list_dir);
} else if (game_dir.path == "SYSTEM") { } else if (game_dir.path == "SYSTEM") {
QString path = QString(FileUtil::GetUserPath(D_NAND_IDX).c_str()) + QString path = QString::fromStdString(FileUtil::GetUserPath(D_NAND_IDX)) +
"00000000000000000000000000000000/title/00040010"; "00000000000000000000000000000000/title/00040010";
watch_list.append(path); watch_list.append(path);
GameListDir* game_list_dir = new GameListDir(game_dir, GameListItemType::SystemDir); GameListDir* game_list_dir = new GameListDir(game_dir, GameListItemType::SystemDir);
emit DirEntryReady({game_list_dir}); emit DirEntryReady({game_list_dir});
AddFstEntriesToGameList(std::string(FileUtil::GetUserPath(D_NAND_IDX).c_str()) + AddFstEntriesToGameList(path.toStdString(), 2, game_list_dir);
"00000000000000000000000000000000/title/00040010",
2, game_list_dir);
} else { } else {
watch_list.append(game_dir.path); watch_list.append(game_dir.path);
GameListDir* game_list_dir = new GameListDir(game_dir); GameListDir* game_list_dir = new GameListDir(game_dir);