diff options
author | Jan Dalheimer <jan@dalheimer.de> | 2014-07-30 21:45:12 +0200 |
---|---|---|
committer | Jan Dalheimer <jan@dalheimer.de> | 2014-07-30 21:45:12 +0200 |
commit | 21597da33d610f5c322c4fcd5317426f7dcf8c28 (patch) | |
tree | 9a4a27dfeea890b49e7e17866228dd46b00f7174 /gui | |
parent | 151fbde8d09747001b8d212bee4a1c1154e157a7 (diff) | |
parent | c0254d9a75a1f0f784a3e9b6874475b2c2a3ab8f (diff) | |
download | PrismLauncher-21597da33d610f5c322c4fcd5317426f7dcf8c28.tar.gz PrismLauncher-21597da33d610f5c322c4fcd5317426f7dcf8c28.tar.bz2 PrismLauncher-21597da33d610f5c322c4fcd5317426f7dcf8c28.zip |
Merge branch 'Loetkolben-pr_feature_warnProblematicInstPath' into develop
Closes #400
Diffstat (limited to 'gui')
-rw-r--r-- | gui/MainWindow.cpp | 18 | ||||
-rw-r--r-- | gui/MainWindow.h | 1 | ||||
-rw-r--r-- | gui/pages/global/MultiMCPage.cpp | 29 |
3 files changed, 44 insertions, 4 deletions
diff --git a/gui/MainWindow.cpp b/gui/MainWindow.cpp index ce03d7b9..d3dc8f6e 100644 --- a/gui/MainWindow.cpp +++ b/gui/MainWindow.cpp @@ -1533,3 +1533,21 @@ void MainWindow::checkSetDefaultJava() MMC->settings()->set("JavaPath", QString("java")); } } + +void MainWindow::checkInstancePathForProblems() +{ + QString instanceFolder = MMC->settings()->get("InstanceDir").toString(); + if (checkProblemticPathJava(QDir(instanceFolder))) + { + QMessageBox warning; + warning.setText(tr( + "Your instance folder contains \'!\' and this is known to cause Java problems!")); + warning.setInformativeText( + tr("You have now three options: <br/>" + " - ignore this warning <br/>" + " - change the instance dir in the settings <br/>" + " - move this installation of MultiMC5 to a different folder")); + warning.setDefaultButton(QMessageBox::Ok); + warning.exec(); + } +} diff --git a/gui/MainWindow.h b/gui/MainWindow.h index 32ad4daf..d32a245c 100644 --- a/gui/MainWindow.h +++ b/gui/MainWindow.h @@ -52,6 +52,7 @@ public: void checkSetDefaultJava(); void checkMigrateLegacyAssets(); + void checkInstancePathForProblems(); private slots: diff --git a/gui/pages/global/MultiMCPage.cpp b/gui/pages/global/MultiMCPage.cpp index 2d6eb7d5..73a5ff20 100644 --- a/gui/pages/global/MultiMCPage.cpp +++ b/gui/pages/global/MultiMCPage.cpp @@ -112,16 +112,37 @@ void MultiMCPage::on_ftbBrowseBtn_clicked() void MultiMCPage::on_instDirBrowseBtn_clicked() { - QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Directory"), - ui->instDirTextBox->text()); - QString cooked_dir = NormalizePath(raw_dir); + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Directory"), + ui->instDirTextBox->text()); + QString cooked_dir = NormalizePath(raw_dir); // do not allow current dir - it's dirty. Do not allow dirs that don't exist if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) { - ui->instDirTextBox->setText(cooked_dir); + if (checkProblemticPathJava(QDir(cooked_dir))) + { + QMessageBox warning; + warning.setText(tr("You're trying to specify an instance folder which\'s path " + "contains at least one \'!\'. " + "Java is known to cause problems if that is the case, your " + "instances (probably) won't start!")); + warning.setInformativeText( + tr("Do you really want to use this path? " + "Selecting \"No\" will close this and not alter your instance path.")); + warning.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + int result = warning.exec(); + if (result == QMessageBox::Yes) + { + ui->instDirTextBox->setText(cooked_dir); + } + } + else + { + ui->instDirTextBox->setText(cooked_dir); + } } } + void MultiMCPage::on_iconsDirBrowseBtn_clicked() { QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Directory"), |