NOISSUE ifdef the hell out of MCEdit launch on Windows
Setting the work directory was not enough.
This commit is contained in:
parent
f4de049b13
commit
6ebf6e7785
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,7 @@ private:
|
||||
QModelIndex getSelectedWorld();
|
||||
bool isWorldSafe(QModelIndex index);
|
||||
bool worldSafetyNagQuestion();
|
||||
void mceditError();
|
||||
|
||||
private:
|
||||
Ui::WorldListPage *ui;
|
||||
|
Loading…
Reference in New Issue
Block a user