aboutsummaryrefslogtreecommitdiff
path: root/launcher/FileSystem.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-11-21 12:14:49 +0100
committerGitHub <noreply@github.com>2022-11-21 12:14:49 +0100
commitc74f852364d512dd850111f92cc989c0c2ce7392 (patch)
tree7ae2a740b0195b0adcdbcd3460b5e75a68bc7b5d /launcher/FileSystem.cpp
parent30607c34a153fd32085712e18827983772d77f7b (diff)
parentfe94c3609ef875166b71b9f6c540c45eff97a5ab (diff)
downloadPrismLauncher-c74f852364d512dd850111f92cc989c0c2ce7392.tar.gz
PrismLauncher-c74f852364d512dd850111f92cc989c0c2ce7392.tar.bz2
PrismLauncher-c74f852364d512dd850111f92cc989c0c2ce7392.zip
Merge pull request #243 from Scrumplex/migration-dialog
Closes https://github.com/PrismLauncher/PrismLauncher/issues/46 Closes https://github.com/PrismLauncher/PrismLauncher/issues/204
Diffstat (limited to 'launcher/FileSystem.cpp')
-rw-r--r--launcher/FileSystem.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index 4a8f4bd3..0c6527b1 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -152,9 +152,10 @@ bool ensureFolderPathExists(QString foldernamepath)
/// @brief Copies a directory and it's contents from src to dest
/// @param offset subdirectory form src to copy to dest
/// @return if there was an error during the filecopy
-bool copy::operator()(const QString& offset)
+bool copy::operator()(const QString& offset, bool dryRun)
{
using copy_opts = fs::copy_options;
+ m_copied = 0; // reset counter
// NOTE always deep copy on windows. the alternatives are too messy.
#if defined Q_OS_WIN32
@@ -174,13 +175,14 @@ 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);
- ensureFilePathExists(dst_path);
-
- fs::copy(StringUtils::toStdString(src_path), StringUtils::toStdString(dst_path), opt, err);
+ if (!dryRun) {
+ ensureFilePathExists(dst_path);
+ fs::copy(StringUtils::toStdString(src_path), StringUtils::toStdString(dst_path), opt, err);
+ }
if (err) {
qWarning() << "Failed to copy files:" << QString::fromStdString(err.message());
qDebug() << "Source file:" << src_path;