diff options
| author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-05-07 13:21:21 -0700 |
|---|---|---|
| committer | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-05-07 13:21:21 -0700 |
| commit | 884ac7307817e10f04512a29213a017ca344c16d (patch) | |
| tree | 37bcb97dfec8516edba3501a5475b1daf314d2b7 /launcher/MMCZip.cpp | |
| parent | 718abaae0ef465050c81c0dfba63ce9f0fff17fc (diff) | |
| parent | ce5bb29c442cee3654c5f4287a999d5d6593032f (diff) | |
| download | PrismLauncher-884ac7307817e10f04512a29213a017ca344c16d.tar.gz PrismLauncher-884ac7307817e10f04512a29213a017ca344c16d.tar.bz2 PrismLauncher-884ac7307817e10f04512a29213a017ca344c16d.zip | |
Merge remote-tracking branch 'upstream/develop' into better-tasks
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
Diffstat (limited to 'launcher/MMCZip.cpp')
| -rw-r--r-- | launcher/MMCZip.cpp | 16 |
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) { |
