Merge pull request #539 from GriffinRichards/recent-fail

Stop misleading error when recent project doesn't exist
This commit is contained in:
GriffinR 2023-08-19 10:01:27 -04:00 committed by GitHub
commit 0148580bd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -13,6 +13,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.

View file

@ -484,12 +484,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) {