aboutsummaryrefslogtreecommitdiff
path: root/launcher/MMCZip.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-05-02 12:11:41 +0200
committerGitHub <noreply@github.com>2023-05-02 12:11:41 +0200
commit64ba5e4ed1456bed159cfe7b41ed9175b8baf5c4 (patch)
tree9e0de7effc3ca0b49ce2c5ffb2c1462c626929c3 /launcher/MMCZip.cpp
parentae75585b52078ca6d89b4014668c08d9aea4a17b (diff)
parentd80dee2a54a172fa19c0bc21486ee43ef2e3514d (diff)
downloadPrismLauncher-64ba5e4ed1456bed159cfe7b41ed9175b8baf5c4.tar.gz
PrismLauncher-64ba5e4ed1456bed159cfe7b41ed9175b8baf5c4.tar.bz2
PrismLauncher-64ba5e4ed1456bed159cfe7b41ed9175b8baf5c4.zip
Merge pull request #833 from Ryex/advanced_copy_instance
Diffstat (limited to 'launcher/MMCZip.cpp')
-rw-r--r--launcher/MMCZip.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/launcher/MMCZip.cpp b/launcher/MMCZip.cpp
index 1eda43fe..1a336375 100644
--- a/launcher/MMCZip.cpp
+++ b/launcher/MMCZip.cpp
@@ -94,20 +94,28 @@ bool MMCZip::mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &containe
return true;
}
-bool MMCZip::compressDirFiles(QuaZip *zip, QString dir, QFileInfoList files)
+bool MMCZip::compressDirFiles(QuaZip *zip, QString dir, QFileInfoList files, bool followSymlinks)
{
QDir directory(dir);
if (!directory.exists()) return false;
for (auto e : files) {
auto filePath = directory.relativeFilePath(e.absoluteFilePath());
- if( !JlCompress::compressFile(zip, e.absoluteFilePath(), filePath)) return false;
+ auto srcPath = e.absoluteFilePath();
+ if (followSymlinks) {
+ if (e.isSymLink()) {
+ srcPath = e.symLinkTarget();
+ } else {
+ srcPath = e.canonicalFilePath();
+ }
+ }
+ if( !JlCompress::compressFile(zip, srcPath, filePath)) return false;
}
return true;
}
-bool MMCZip::compressDirFiles(QString fileCompressed, QString dir, QFileInfoList files)
+bool MMCZip::compressDirFiles(QString fileCompressed, QString dir, QFileInfoList files, bool followSymlinks)
{
QuaZip zip(fileCompressed);
QDir().mkpath(QFileInfo(fileCompressed).absolutePath());
@@ -116,7 +124,7 @@ bool MMCZip::compressDirFiles(QString fileCompressed, QString dir, QFileInfoList
return false;
}
- auto result = compressDirFiles(&zip, dir, files);
+ auto result = compressDirFiles(&zip, dir, files, followSymlinks);
zip.close();
if(zip.getZipError()!=0) {