summaryrefslogtreecommitdiffstats
path: root/api/logic/InstanceCopyTask.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-09-05 23:38:17 +0200
committerPetr Mrázek <peterix@gmail.com>2017-09-05 23:38:17 +0200
commitb61407a75d06abd61ce89f972581fa36a961d906 (patch)
tree8c7f113a053e5f660756bda2f11cbda5b8af6985 /api/logic/InstanceCopyTask.cpp
parentd80382180ef14d814eb9f6d7f2bf5db362f25cc2 (diff)
downloadMultiMC-b61407a75d06abd61ce89f972581fa36a961d906.tar
MultiMC-b61407a75d06abd61ce89f972581fa36a961d906.tar.gz
MultiMC-b61407a75d06abd61ce89f972581fa36a961d906.tar.lz
MultiMC-b61407a75d06abd61ce89f972581fa36a961d906.tar.xz
MultiMC-b61407a75d06abd61ce89f972581fa36a961d906.zip
NOISSUE retry committing instances if it fails a few times
This should fix issues with antivirus locking files/folders on Windows.
Diffstat (limited to 'api/logic/InstanceCopyTask.cpp')
-rw-r--r--api/logic/InstanceCopyTask.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/api/logic/InstanceCopyTask.cpp b/api/logic/InstanceCopyTask.cpp
index e9ed9a82..65c6b9ff 100644
--- a/api/logic/InstanceCopyTask.cpp
+++ b/api/logic/InstanceCopyTask.cpp
@@ -6,10 +6,10 @@
#include "pathmatcher/RegexpMatcher.h"
#include <QtConcurrentRun>
-InstanceCopyTask::InstanceCopyTask(SettingsObjectPtr settings, BaseInstanceProvider* target, InstancePtr origInstance, const QString& instName, const QString& instIcon, const QString& instGroup, bool copySaves)
+InstanceCopyTask::InstanceCopyTask(SettingsObjectPtr settings, const QString & stagingPath, InstancePtr origInstance, const QString& instName, const QString& instIcon, const QString& instGroup, bool copySaves)
{
m_globalSettings = settings;
- m_target = target;
+ m_stagingPath = stagingPath;
m_origInstance = origInstance;
m_instName = instName;
m_instIcon = instIcon;
@@ -27,7 +27,7 @@ InstanceCopyTask::InstanceCopyTask(SettingsObjectPtr settings, BaseInstanceProvi
void InstanceCopyTask::executeTask()
{
setStatus(tr("Copying instance %1").arg(m_origInstance->name()));
- m_stagingPath = m_target->getStagedInstancePath();
+
FS::copy folderCopy(m_origInstance->instanceRoot(), m_stagingPath);
folderCopy.followSymlinks(false).blacklist(m_matcher.get());
@@ -42,7 +42,6 @@ void InstanceCopyTask::copyFinished()
auto successful = m_copyFuture.result();
if(!successful)
{
- m_target->destroyStagingPath(m_stagingPath);
emitFailed(tr("Instance folder copy failed."));
return;
}
@@ -56,13 +55,11 @@ void InstanceCopyTask::copyFinished()
InstancePtr inst(new NullInstance(m_globalSettings, instanceSettings, m_stagingPath));
inst->setName(m_instName);
inst->setIconKey(m_instIcon);
- m_target->commitStagedInstance(m_stagingPath, m_instName, m_instGroup);
emitSucceeded();
}
void InstanceCopyTask::copyAborted()
{
- m_target->destroyStagingPath(m_stagingPath);
emitFailed(tr("Instance folder copy has been aborted."));
return;
}