diff options
author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2022-10-25 10:59:37 -0700 |
---|---|---|
committer | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2022-11-01 04:24:11 -0700 |
commit | 13c7efa0584caf34950a6e6efa4b8e3bee16d764 (patch) | |
tree | 2478664b4361d38a9f3102597ee3fa2fcaae28a7 /launcher/FileSystem.cpp | |
parent | 1598d6582473f1bb6aa02fd9b4dabc8210771e56 (diff) | |
download | PrismLauncher-13c7efa0584caf34950a6e6efa4b8e3bee16d764.tar.gz PrismLauncher-13c7efa0584caf34950a6e6efa4b8e3bee16d764.tar.bz2 PrismLauncher-13c7efa0584caf34950a6e6efa4b8e3bee16d764.zip |
copy found mods to instance (FTB and Flame)
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/FileSystem.cpp')
-rw-r--r-- | launcher/FileSystem.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp index 4026d6c1..4285fa87 100644 --- a/launcher/FileSystem.cpp +++ b/launcher/FileSystem.cpp @@ -163,6 +163,28 @@ bool ensureFolderPathExists(QString foldernamepath) return success; } +bool copyFile(QString &src, QString &dst) { + using copy_opts = fs::copy_options; + + std::error_code err; + + fs::copy_options opt = copy_opts::none; + // The default behavior is to follow symlinks + opt |= copy_opts::copy_symlinks; + + ensureFilePathExists(dst); + + fs::copy(toStdString(src), toStdString(dst), opt, err); + if (err) { + qWarning() << "Failed to copy files:" << QString::fromStdString(err.message()); + qDebug() << "Source file:" << src; + qDebug() << "Destination file:" << dst; + } + + return err.value() == 0; + +} + bool copy::operator()(const QString& offset) { using copy_opts = fs::copy_options; |