game_list: Use QString::fromStdString() where applicable instead of c_str()

This commit is contained in:
zhupengfei 2018-08-08 16:43:59 +08:00
parent 0233f3286c
commit b71fbe62a8
No known key found for this signature in database
GPG key ID: 85B82A3E62174206

View file

@ -617,7 +617,7 @@ const QStringList GameList::supported_file_extensions = {"3ds", "3dsx", "elf", "
"cci", "cxi", "app"};
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);
}
@ -708,7 +708,7 @@ void GameListWorker::run() {
stop_processing = false;
for (UISettings::GameDir& game_dir : game_dirs) {
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 "
"3DS/00000000000000000000000000000000/"
"00000000000000000000000000000000/title/00040000";
@ -717,14 +717,12 @@ void GameListWorker::run() {
emit DirEntryReady({game_list_dir});
AddFstEntriesToGameList(path.toStdString(), 2, game_list_dir);
} 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";
watch_list.append(path);
GameListDir* game_list_dir = new GameListDir(game_dir, GameListItemType::SystemDir);
emit DirEntryReady({game_list_dir});
AddFstEntriesToGameList(std::string(FileUtil::GetUserPath(D_NAND_IDX).c_str()) +
"00000000000000000000000000000000/title/00040010",
2, game_list_dir);
AddFstEntriesToGameList(path.toStdString(), 2, game_list_dir);
} else {
watch_list.append(game_dir.path);
GameListDir* game_list_dir = new GameListDir(game_dir);