summaryrefslogtreecommitdiffstats
path: root/application/pages/WorldListPage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'application/pages/WorldListPage.cpp')
-rw-r--r--application/pages/WorldListPage.cpp22
1 files changed, 17 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();
}
}