qt: Create addons directory if it does not exist. (#1186)

This commit is contained in:
squidbus 2024-10-01 10:11:41 -07:00 committed by GitHub
parent 3a36615da7
commit 3dea1a9f81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -44,7 +44,6 @@ constexpr auto DOWNLOAD_DIR = "download";
constexpr auto CAPTURES_DIR = "captures";
constexpr auto CHEATS_DIR = "cheats";
constexpr auto PATCHES_DIR = "patches";
constexpr auto ADDONS_DIR = "addcont";
constexpr auto METADATA_DIR = "game_data";
// Filenames

View File

@ -111,12 +111,19 @@ void GameInstallDialog::Save() {
return;
}
if (addonsDirectory.isEmpty() || !QDir(addonsDirectory).exists() ||
!QDir::isAbsolutePath(addonsDirectory)) {
if (addonsDirectory.isEmpty() || !QDir::isAbsolutePath(addonsDirectory)) {
QMessageBox::critical(this, tr("Error"),
"The value for location to install DLC is not valid.");
return;
}
QDir addonsDir(addonsDirectory);
if (!addonsDir.exists()) {
if (!addonsDir.mkpath(".")) {
QMessageBox::critical(this, tr("Error"),
"The DLC install location could not be created.");
return;
}
}
Config::setGameInstallDir(Common::FS::PathFromQString(gamesDirectory));
Config::setAddonInstallDir(Common::FS::PathFromQString(addonsDirectory));