GH-1745 fix crash when using path matching filter on copy operations
Copying instances without saves doesn't crash anymore.
This commit is contained in:
parent
2517d2c84d
commit
a6882787b0
@ -14,24 +14,22 @@ InstanceCopyTask::InstanceCopyTask(SettingsObjectPtr settings, BaseInstanceProvi
|
|||||||
m_instName = instName;
|
m_instName = instName;
|
||||||
m_instIcon = instIcon;
|
m_instIcon = instIcon;
|
||||||
m_instGroup = instGroup;
|
m_instGroup = instGroup;
|
||||||
m_copySaves = copySaves;
|
|
||||||
|
if(!copySaves)
|
||||||
|
{
|
||||||
|
// FIXME: get this from the original instance type...
|
||||||
|
auto matcherReal = new RegexpMatcher("[.]?minecraft/saves");
|
||||||
|
matcherReal->caseSensitive(false);
|
||||||
|
m_matcher.reset(matcherReal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstanceCopyTask::executeTask()
|
void InstanceCopyTask::executeTask()
|
||||||
{
|
{
|
||||||
setStatus(tr("Copying instance %1").arg(m_origInstance->name()));
|
setStatus(tr("Copying instance %1").arg(m_origInstance->name()));
|
||||||
std::unique_ptr<IPathMatcher> matcher;
|
|
||||||
if(!m_copySaves)
|
|
||||||
{
|
|
||||||
// FIXME: get this from the original instance type...
|
|
||||||
auto matcherReal = new RegexpMatcher("[.]?minecraft/saves");
|
|
||||||
matcherReal->caseSensitive(false);
|
|
||||||
matcher.reset(matcherReal);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_stagingPath = m_target->getStagedInstancePath();
|
m_stagingPath = m_target->getStagedInstancePath();
|
||||||
FS::copy folderCopy(m_origInstance->instanceRoot(), m_stagingPath);
|
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);
|
m_copyFuture = QtConcurrent::run(QThreadPool::globalInstance(), folderCopy);
|
||||||
connect(&m_copyFutureWatcher, &QFutureWatcher<bool>::finished, this, &InstanceCopyTask::copyFinished);
|
connect(&m_copyFutureWatcher, &QFutureWatcher<bool>::finished, this, &InstanceCopyTask::copyFinished);
|
||||||
|
@ -34,9 +34,9 @@ private: /* data */
|
|||||||
QString m_instIcon;
|
QString m_instIcon;
|
||||||
QString m_instGroup;
|
QString m_instGroup;
|
||||||
QString m_stagingPath;
|
QString m_stagingPath;
|
||||||
bool m_copySaves = false;
|
|
||||||
QFuture<bool> m_copyFuture;
|
QFuture<bool> m_copyFuture;
|
||||||
QFutureWatcher<bool> m_copyFutureWatcher;
|
QFutureWatcher<bool> m_copyFutureWatcher;
|
||||||
|
std::unique_ptr<IPathMatcher> m_matcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user