diff options
author | flow <flowlnlnln@gmail.com> | 2022-12-01 15:15:15 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-12-01 15:15:15 -0300 |
commit | a116778402bd98ee079488d8c5a27933369e9046 (patch) | |
tree | 8a1e7840e254f48cd1125c82be9ac7980f1eaa0e /launcher/MMCZip.cpp | |
parent | 9e1653ebb471d4d96efda85cbde128c59fe3686a (diff) | |
download | PrismLauncher-a116778402bd98ee079488d8c5a27933369e9046.tar.gz PrismLauncher-a116778402bd98ee079488d8c5a27933369e9046.tar.bz2 PrismLauncher-a116778402bd98ee079488d8c5a27933369e9046.zip |
fix(Inst.Import): don't search inside 'overrides/' for the manifest
It will never be there anyways, and saves a **bunch** of time when the
overrides folder is big and we traverse all the tree when searching for
the MMC 'instance.cfg' file.
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/MMCZip.cpp')
-rw-r--r-- | launcher/MMCZip.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/launcher/MMCZip.cpp b/launcher/MMCZip.cpp index 9f4e968f..f6600343 100644 --- a/launcher/MMCZip.cpp +++ b/launcher/MMCZip.cpp @@ -39,6 +39,7 @@ #include "MMCZip.h" #include "FileSystem.h" +#include <QCoreApplication> #include <QDebug> // ours @@ -228,23 +229,27 @@ bool MMCZip::createModdedJar(QString sourceJarPath, QString targetJarPath, const } // ours -QString MMCZip::findFolderOfFileInZip(QuaZip * zip, const QString & what, const QString &root) +QString MMCZip::findFolderOfFileInZip(QuaZip* zip, const QString& what, const QStringList& ignore_paths, const QString& root) { QuaZipDir rootDir(zip, root); - for(auto fileName: rootDir.entryList(QDir::Files)) - { - if(fileName == what) + for (auto&& fileName : rootDir.entryList(QDir::Files)) { + if (fileName == what) return root; + + QCoreApplication::processEvents(); } - for(auto fileName: rootDir.entryList(QDir::Dirs)) - { - QString result = findFolderOfFileInZip(zip, what, root + fileName); - if(!result.isEmpty()) - { + + // Recurse the search to non-ignored subfolders + for (auto&& fileName : rootDir.entryList(QDir::Dirs)) { + if (ignore_paths.contains(fileName)) + continue; + + QString result = findFolderOfFileInZip(zip, what, ignore_paths, root + fileName); + if (!result.isEmpty()) return result; - } } - return QString(); + + return {}; } // ours |