diff options
Diffstat (limited to 'launcher')
-rw-r--r-- | launcher/FileSystem.cpp | 2 | ||||
-rw-r--r-- | launcher/FileSystem.h | 12 | ||||
-rw-r--r-- | launcher/InstanceCopyTask.cpp | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp index 4a8f4bd3..a3b9fe1f 100644 --- a/launcher/FileSystem.cpp +++ b/launcher/FileSystem.cpp @@ -174,7 +174,7 @@ bool copy::operator()(const QString& offset) // Function that'll do the actual copying auto copy_file = [&](QString src_path, QString relative_dst_path) { - if (m_blacklist && m_blacklist->matches(relative_dst_path)) + if (m_matcher && (m_matcher->matches(relative_dst_path) == !m_whitelist)) return; auto dst_path = PathCombine(dst, relative_dst_path); diff --git a/launcher/FileSystem.h b/launcher/FileSystem.h index b7e175fd..e239984e 100644 --- a/launcher/FileSystem.h +++ b/launcher/FileSystem.h @@ -88,9 +88,14 @@ class copy { m_followSymlinks = follow; return *this; } - copy& blacklist(const IPathMatcher* filter) + copy& matcher(const IPathMatcher* filter) { - m_blacklist = filter; + m_matcher = filter; + return *this; + } + copy& whitelist(bool whitelist) + { + m_whitelist = whitelist; return *this; } bool operator()() { return operator()(QString()); } @@ -100,7 +105,8 @@ class copy { private: bool m_followSymlinks = true; - const IPathMatcher* m_blacklist = nullptr; + const IPathMatcher* m_matcher = nullptr; + bool m_whitelist = false; QDir m_src; QDir m_dst; }; diff --git a/launcher/InstanceCopyTask.cpp b/launcher/InstanceCopyTask.cpp index a4ea947d..fb118353 100644 --- a/launcher/InstanceCopyTask.cpp +++ b/launcher/InstanceCopyTask.cpp @@ -26,7 +26,7 @@ void InstanceCopyTask::executeTask() setStatus(tr("Copying instance %1").arg(m_origInstance->name())); FS::copy folderCopy(m_origInstance->instanceRoot(), m_stagingPath); - folderCopy.followSymlinks(false).blacklist(m_matcher.get()); + folderCopy.followSymlinks(false).matcher(m_matcher.get()); m_copyFuture = QtConcurrent::run(QThreadPool::globalInstance(), folderCopy); connect(&m_copyFutureWatcher, &QFutureWatcher<bool>::finished, this, &InstanceCopyTask::copyFinished); |