summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-11-03 02:41:01 +0100
committerPetr Mrázek <peterix@gmail.com>2016-11-03 02:41:01 +0100
commit6ebf6e7785da79f7f3eb28176951d0e9d22a20e8 (patch)
tree658815468ae55b35d913219207d75987e33e60c9 /application
parentf4de049b134cae226e944a5039eae67657877dd3 (diff)
downloadMultiMC-6ebf6e7785da79f7f3eb28176951d0e9d22a20e8.tar
MultiMC-6ebf6e7785da79f7f3eb28176951d0e9d22a20e8.tar.gz
MultiMC-6ebf6e7785da79f7f3eb28176951d0e9d22a20e8.tar.lz
MultiMC-6ebf6e7785da79f7f3eb28176951d0e9d22a20e8.tar.xz
MultiMC-6ebf6e7785da79f7f3eb28176951d0e9d22a20e8.zip
NOISSUE ifdef the hell out of MCEdit launch on Windows
Setting the work directory was not enough.
Diffstat (limited to 'application')
-rw-r--r--application/pages/WorldListPage.cpp22
-rw-r--r--application/pages/WorldListPage.h1
2 files changed, 18 insertions, 5 deletions
diff --git a/application/pages/WorldListPage.cpp b/application/pages/WorldListPage.cpp
index cc712572..4666b1ef 100644
--- a/application/pages/WorldListPage.cpp
+++ b/application/pages/WorldListPage.cpp
@@ -172,12 +172,19 @@ void WorldListPage::on_mcEditBtn_clicked()
auto program = mcedit->getProgramPath();
if(program.size())
{
+#ifdef Q_OS_WIN32
+ if(!QProcess::startDetached(program, {fullPath}, mceditPath))
+ {
+ mceditError();
+ }
+#else
m_mceditProcess.reset(new LoggedProcess());
m_mceditProcess->setDetachable(true);
connect(m_mceditProcess.get(), &LoggedProcess::stateChanged, this, &WorldListPage::mceditState);
m_mceditProcess->start(program, {fullPath});
m_mceditProcess->setWorkingDirectory(mceditPath);
m_mceditStarting = true;
+#endif
}
else
{
@@ -189,6 +196,15 @@ void WorldListPage::on_mcEditBtn_clicked()
}
}
+void WorldListPage::mceditError()
+{
+ QMessageBox::warning(
+ this->parentWidget(),
+ tr("MCEdit failed to start!"),
+ tr("MCEdit failed to start.\nIt may be necessary to reinstall it.")
+ );
+}
+
void WorldListPage::mceditState(LoggedProcess::State state)
{
bool failed = false;
@@ -212,11 +228,7 @@ void WorldListPage::mceditState(LoggedProcess::State state)
}
if(failed)
{
- QMessageBox::warning(
- this->parentWidget(),
- tr("MCEdit failed to start!"),
- tr("MCEdit failed to start.\nIt may be necessary to reinstall it.")
- );
+ mceditError();
}
}
diff --git a/application/pages/WorldListPage.h b/application/pages/WorldListPage.h
index 0a09764e..5e7432e2 100644
--- a/application/pages/WorldListPage.h
+++ b/application/pages/WorldListPage.h
@@ -70,6 +70,7 @@ private:
QModelIndex getSelectedWorld();
bool isWorldSafe(QModelIndex index);
bool worldSafetyNagQuestion();
+ void mceditError();
private:
Ui::WorldListPage *ui;