Stop misleading error when recent project doesn't exist

This commit is contained in:
GriffinR 2023-08-09 14:42:03 -04:00
parent e184295c9e
commit a366c7cffe
2 changed files with 11 additions and 4 deletions

View file

@ -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.

View file

@ -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) {