summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2018-08-06 14:57:14 -0400
committerGravatar Lioncash2018-08-06 15:06:29 -0400
commit10d693b9c2b6c7d7fa158c25ff075c16280be7be (patch)
treedee76bea8e310a83d7229c40aa53901292835352
parentgame_list: Use QString::fromStdString() where applicable instead of c_str() (diff)
downloadyuzu-10d693b9c2b6c7d7fa158c25ff075c16280be7be.tar.gz
yuzu-10d693b9c2b6c7d7fa158c25ff075c16280be7be.tar.xz
yuzu-10d693b9c2b6c7d7fa158c25ff075c16280be7be.zip
game_list: Remove unnecessary conversion to std::string in ValidateEntry()
We can just use the file interfaces that Qt provides to prevent needing to convert to std::string.
-rw-r--r--src/yuzu/game_list.cpp18
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) {
258 258
259void GameList::ValidateEntry(const QModelIndex& item) { 259void GameList::ValidateEntry(const QModelIndex& item) {
260 // We don't care about the individual QStandardItem that was selected, but its row. 260 // We don't care about the individual QStandardItem that was selected, but its row.
261 int row = item_model->itemFromIndex(item)->row(); 261 const int row = item_model->itemFromIndex(item)->row();
262 QStandardItem* child_file = item_model->invisibleRootItem()->child(row, COLUMN_NAME); 262 const QStandardItem* child_file = item_model->invisibleRootItem()->child(row, COLUMN_NAME);
263 QString file_path = child_file->data(GameListItemPath::FullPathRole).toString(); 263 const QString file_path = child_file->data(GameListItemPath::FullPathRole).toString();
264 264
265 if (file_path.isEmpty()) 265 if (file_path.isEmpty())
266 return; 266 return;
267 std::string std_file_path(file_path.toStdString()); 267
268 if (!FileUtil::Exists(std_file_path)) 268 if (!QFileInfo::exists(file_path))
269 return; 269 return;
270 if (FileUtil::IsDirectory(std_file_path)) { 270
271 QDir dir(std_file_path.c_str()); 271 const QFileInfo file_info{file_path};
272 QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files); 272 if (file_info.isDir()) {
273 const QDir dir{file_path};
274 const QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files);
273 if (matching_main.size() == 1) { 275 if (matching_main.size() == 1) {
274 emit GameChosen(dir.path() + DIR_SEP + matching_main[0]); 276 emit GameChosen(dir.path() + DIR_SEP + matching_main[0]);
275 } 277 }