diff options
| author | 2018-06-14 17:25:40 -0400 | |
|---|---|---|
| committer | 2018-06-14 17:25:40 -0400 | |
| commit | acc8fe5a2a2d46c0f89642a9eccaedcea47c6c4f (patch) | |
| tree | de2fc83d2e2a10579970337059fe01337d1378d9 /src | |
| parent | Add 'Load Folder' menu option (diff) | |
| download | yuzu-acc8fe5a2a2d46c0f89642a9eccaedcea47c6c4f.tar.gz yuzu-acc8fe5a2a2d46c0f89642a9eccaedcea47c6c4f.tar.xz yuzu-acc8fe5a2a2d46c0f89642a9eccaedcea47c6c4f.zip | |
Bug fixes, testing, and review changes
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/game_list.cpp | 17 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 10 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 6b0f07757..9e585b082 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -265,8 +265,17 @@ void GameList::ValidateEntry(const QModelIndex& item) { | |||
| 265 | if (file_path.isEmpty()) | 265 | if (file_path.isEmpty()) |
| 266 | return; | 266 | return; |
| 267 | std::string std_file_path(file_path.toStdString()); | 267 | std::string std_file_path(file_path.toStdString()); |
| 268 | if (!FileUtil::Exists(std_file_path) || FileUtil::IsDirectory(std_file_path)) | 268 | if (!FileUtil::Exists(std_file_path)) |
| 269 | return; | 269 | return; |
| 270 | if (FileUtil::IsDirectory(std_file_path)) { | ||
| 271 | QDir dir(std_file_path.c_str()); | ||
| 272 | QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files); | ||
| 273 | if (matching_main.size() == 1) { | ||
| 274 | emit GameChosen(dir.path() + DIR_SEP + matching_main[0]); | ||
| 275 | } | ||
| 276 | return; | ||
| 277 | } | ||
| 278 | |||
| 270 | // Users usually want to run a diffrent game after closing one | 279 | // Users usually want to run a diffrent game after closing one |
| 271 | search_field->clear(); | 280 | search_field->clear(); |
| 272 | emit GameChosen(file_path); | 281 | emit GameChosen(file_path); |
| @@ -368,10 +377,10 @@ static bool IsExtractedNCAMain(const std::string& file_name) { | |||
| 368 | return QFileInfo(file_name.c_str()).fileName() == "main"; | 377 | return QFileInfo(file_name.c_str()).fileName() == "main"; |
| 369 | } | 378 | } |
| 370 | 379 | ||
| 371 | static QString FormatGameName(std::string physical_name) { | 380 | static QString FormatGameName(const std::string& physical_name) { |
| 372 | QFileInfo fileInfo(physical_name.c_str()); | 381 | QFileInfo file_info(physical_name.c_str()); |
| 373 | if (IsExtractedNCAMain(physical_name)) { | 382 | if (IsExtractedNCAMain(physical_name)) { |
| 374 | return fileInfo.dir().dirName(); | 383 | return file_info.dir().path(); |
| 375 | } else { | 384 | } else { |
| 376 | return QString::fromStdString(physical_name); | 385 | return QString::fromStdString(physical_name); |
| 377 | } | 386 | } |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index e2afe2131..97be548d7 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <QMessageBox> | 13 | #include <QMessageBox> |
| 14 | #include <QtGui> | 14 | #include <QtGui> |
| 15 | #include <QtWidgets> | 15 | #include <QtWidgets> |
| 16 | #include "common/common_paths.h" | ||
| 16 | #include "common/logging/backend.h" | 17 | #include "common/logging/backend.h" |
| 17 | #include "common/logging/filter.h" | 18 | #include "common/logging/filter.h" |
| 18 | #include "common/logging/log.h" | 19 | #include "common/logging/log.h" |
| @@ -568,9 +569,12 @@ void GMainWindow::OnMenuLoadFile() { | |||
| 568 | void GMainWindow::OnMenuLoadFolder() { | 569 | void GMainWindow::OnMenuLoadFolder() { |
| 569 | QDir dir = QFileDialog::getExistingDirectory(this, tr("Open Extracted ROM Directory")); | 570 | QDir dir = QFileDialog::getExistingDirectory(this, tr("Open Extracted ROM Directory")); |
| 570 | 571 | ||
| 571 | QStringList matchingMain = dir.entryList(QStringList() << "main", QDir::Files); | 572 | QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files); |
| 572 | if (matchingMain.size() == 1) { | 573 | if (matching_main.size() == 1) { |
| 573 | BootGame(matchingMain[0]); | 574 | BootGame(dir.path() + DIR_SEP + matching_main[0]); |
| 575 | } else { | ||
| 576 | QMessageBox::warning(this, tr("Invalid Directory Selected"), | ||
| 577 | tr("The directory you have selected does not contain a 'main' file.")); | ||
| 574 | } | 578 | } |
| 575 | } | 579 | } |
| 576 | 580 | ||