diff options
author | Lioncash <mathew1800@gmail.com> | 2018-08-06 20:57:14 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-08-06 21:06:29 +0200 |
commit | 10d693b9c2b6c7d7fa158c25ff075c16280be7be (patch) | |
tree | dee76bea8e310a83d7229c40aa53901292835352 | |
parent | game_list: Use QString::fromStdString() where applicable instead of c_str() (diff) | |
download | yuzu-10d693b9c2b6c7d7fa158c25ff075c16280be7be.tar yuzu-10d693b9c2b6c7d7fa158c25ff075c16280be7be.tar.gz yuzu-10d693b9c2b6c7d7fa158c25ff075c16280be7be.tar.bz2 yuzu-10d693b9c2b6c7d7fa158c25ff075c16280be7be.tar.lz yuzu-10d693b9c2b6c7d7fa158c25ff075c16280be7be.tar.xz yuzu-10d693b9c2b6c7d7fa158c25ff075c16280be7be.tar.zst yuzu-10d693b9c2b6c7d7fa158c25ff075c16280be7be.zip |
-rw-r--r-- | src/yuzu/game_list.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 166c16225..bfce3671f 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -258,18 +258,20 @@ void GameList::AddEntry(const QList<QStandardItem*>& entry_items) { void GameList::ValidateEntry(const QModelIndex& item) { // We don't care about the individual QStandardItem that was selected, but its row. - int row = item_model->itemFromIndex(item)->row(); - QStandardItem* child_file = item_model->invisibleRootItem()->child(row, COLUMN_NAME); - QString file_path = child_file->data(GameListItemPath::FullPathRole).toString(); + const int row = item_model->itemFromIndex(item)->row(); + const QStandardItem* child_file = item_model->invisibleRootItem()->child(row, COLUMN_NAME); + const QString file_path = child_file->data(GameListItemPath::FullPathRole).toString(); if (file_path.isEmpty()) return; - std::string std_file_path(file_path.toStdString()); - if (!FileUtil::Exists(std_file_path)) + + if (!QFileInfo::exists(file_path)) return; - if (FileUtil::IsDirectory(std_file_path)) { - QDir dir(std_file_path.c_str()); - QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files); + + const QFileInfo file_info{file_path}; + if (file_info.isDir()) { + const QDir dir{file_path}; + const QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files); if (matching_main.size() == 1) { emit GameChosen(dir.path() + DIR_SEP + matching_main[0]); } |