diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-02-16 12:04:26 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-02-16 12:04:26 +0100 |
commit | 1dc34269bde4611d1a1c76f01df6dacd85f79c07 (patch) | |
tree | 5c3fe83e182023582b624b567f4cdaaea93cc6c0 /gui/dialogs | |
parent | 2e64d0308c96b18532918d36794368eb1deb24cd (diff) | |
download | MultiMC-1dc34269bde4611d1a1c76f01df6dacd85f79c07.tar MultiMC-1dc34269bde4611d1a1c76f01df6dacd85f79c07.tar.gz MultiMC-1dc34269bde4611d1a1c76f01df6dacd85f79c07.tar.lz MultiMC-1dc34269bde4611d1a1c76f01df6dacd85f79c07.tar.xz MultiMC-1dc34269bde4611d1a1c76f01df6dacd85f79c07.zip |
Fix path selections for tools (settings dialog)
Diffstat (limited to 'gui/dialogs')
-rw-r--r-- | gui/dialogs/SettingsDialog.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/gui/dialogs/SettingsDialog.cpp b/gui/dialogs/SettingsDialog.cpp index 9423d7eb..d20c0aa7 100644 --- a/gui/dialogs/SettingsDialog.cpp +++ b/gui/dialogs/SettingsDialog.cpp @@ -527,6 +527,10 @@ void SettingsDialog::on_jprofilerPathBtn_clicked() { ui->jprofilerPathEdit->setText(cooked_dir); } + else + { + // FIXME: see below... + } } void SettingsDialog::on_jprofilerCheckBtn_clicked() { @@ -546,12 +550,18 @@ void SettingsDialog::on_jvisualvmPathBtn_clicked() { QString raw_dir = QFileDialog::getOpenFileName(this, tr("JVisualVM Executable"), ui->jvisualvmPathEdit->text()); - QString cooked_dir = NormalizePath(raw_dir); + QString cooked_path = NormalizePath(raw_dir); + QFileInfo finfo(cooked_path); // do not allow current dir - it's dirty. Do not allow dirs that don't exist - if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists()) + if (!cooked_path.isEmpty() && finfo.isExecutable() && finfo.isFile()) { - ui->jvisualvmPathEdit->setText(cooked_dir); + ui->jvisualvmPathEdit->setText(cooked_path); + } + else + { + // FIXME: report error here, or run the checker instead of that condition above. + // ideally unify all the sanity checks and put them into the relevant classes } } void SettingsDialog::on_jvisualvmCheckBtn_clicked() @@ -570,8 +580,8 @@ void SettingsDialog::on_jvisualvmCheckBtn_clicked() void SettingsDialog::on_mceditPathBtn_clicked() { - QString raw_dir = QFileDialog::getOpenFileName(this, tr("MCEdit Path"), - ui->jvisualvmPathEdit->text()); + QString raw_dir = QFileDialog::getExistingDirectory(this, tr("MCEdit Path"), + ui->mceditPathEdit->text()); QString cooked_dir = NormalizePath(raw_dir); // do not allow current dir - it's dirty. Do not allow dirs that don't exist @@ -579,6 +589,9 @@ void SettingsDialog::on_mceditPathBtn_clicked() { ui->mceditPathEdit->setText(cooked_dir); } + { + // FIXME: as above. + } } void SettingsDialog::on_mceditCheckBtn_clicked() { |