Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop misleading error when recent project doesn't exist #539

Merged
merged 1 commit into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
### Changed
- The Palette Editor now remembers the Bit Depth setting.
- The min/max levels on the Wild Pokémon tab will now adjust automatically if they invalidate each other.
- If the recent project directory doesn't exist Porymap will open an empty project instead of failing with a misleading error message.

### Fixed
- Fix text boxes in the Palette Editor calculating color incorrectly.
Expand Down
14 changes: 10 additions & 4 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,18 @@ bool MainWindow::openRecentProject() {
return false;

QString default_dir = porymapConfig.getRecentProject();
if (!default_dir.isNull() && default_dir.length() > 0) {
logInfo(QString("Opening recent project: '%1'").arg(default_dir));
return openProject(default_dir);
if (default_dir.isNull() || default_dir.length() <= 0)
return false;

if (!QDir(default_dir).exists()) {
QString message = QString("Recent project directory '%1' doesn't exist.").arg(QDir::toNativeSeparators(default_dir));
logWarn(message);
this->statusBar()->showMessage(message);
return false;
}

return false;
logInfo(QString("Opening recent project: '%1'").arg(default_dir));
return openProject(default_dir);
}

bool MainWindow::openProject(QString dir) {
Expand Down
Loading