diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-12-08 21:58:31 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-12-08 21:58:31 +0100 |
commit | a6882787b0affd1adbdcdd794998f2a807fd69b4 (patch) | |
tree | b938f0aba40afb87095eb0b5a0b3872382bcd689 /api/logic/InstanceCopyTask.cpp | |
parent | 2517d2c84d46892e4744bc5cbebb5119a9c9587d (diff) | |
download | MultiMC-a6882787b0affd1adbdcdd794998f2a807fd69b4.tar MultiMC-a6882787b0affd1adbdcdd794998f2a807fd69b4.tar.gz MultiMC-a6882787b0affd1adbdcdd794998f2a807fd69b4.tar.lz MultiMC-a6882787b0affd1adbdcdd794998f2a807fd69b4.tar.xz MultiMC-a6882787b0affd1adbdcdd794998f2a807fd69b4.zip |
GH-1745 fix crash when using path matching filter on copy operations
Copying instances without saves doesn't crash anymore.
Diffstat (limited to 'api/logic/InstanceCopyTask.cpp')
-rw-r--r-- | api/logic/InstanceCopyTask.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/api/logic/InstanceCopyTask.cpp b/api/logic/InstanceCopyTask.cpp index 3150c383..20c09907 100644 --- a/api/logic/InstanceCopyTask.cpp +++ b/api/logic/InstanceCopyTask.cpp @@ -14,24 +14,22 @@ InstanceCopyTask::InstanceCopyTask(SettingsObjectPtr settings, BaseInstanceProvi m_instName = instName; m_instIcon = instIcon; m_instGroup = instGroup; - m_copySaves = copySaves; -} -void InstanceCopyTask::executeTask() -{ - setStatus(tr("Copying instance %1").arg(m_origInstance->name())); - std::unique_ptr<IPathMatcher> matcher; - if(!m_copySaves) + if(!copySaves) { // FIXME: get this from the original instance type... auto matcherReal = new RegexpMatcher("[.]?minecraft/saves"); matcherReal->caseSensitive(false); - matcher.reset(matcherReal); + m_matcher.reset(matcherReal); } +} +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(matcher.get()); + folderCopy.followSymlinks(false).blacklist(m_matcher.get()); m_copyFuture = QtConcurrent::run(QThreadPool::globalInstance(), folderCopy); connect(&m_copyFutureWatcher, &QFutureWatcher<bool>::finished, this, &InstanceCopyTask::copyFinished); |