pollymc/launcher/InstanceCreationTask.cpp

30 lines
868 B
C++
Raw Normal View History

2016-10-03 04:25:54 +05:30
#include "InstanceCreationTask.h"
#include <QDebug>
2016-10-03 04:25:54 +05:30
InstanceCreationTask::InstanceCreationTask() = default;
2016-10-03 04:25:54 +05:30
void InstanceCreationTask::executeTask()
{
if (updateInstance()) {
emitSucceeded();
return;
}
// If this is set, it means we're updating an instance. Since the previous step likely
// removed some old files, we'd better not let the user abort the next task, since it'd
// put the instance in an invalid state.
// TODO: Figure out an unexpensive way of making such file removal a recoverable transaction.
setAbortStatus(!shouldOverride());
if (createInstance()) {
emitSucceeded();
return;
2018-07-15 18:21:05 +05:30
}
qWarning() << "Instance creation failed!";
if (!m_error_message.isEmpty())
qWarning() << "Reason: " << m_error_message;
emitFailed(tr("Error while creating new instance."));
2016-10-03 04:25:54 +05:30
}