diff options
author | swirl <swurl@swurl.xyz> | 2022-02-03 14:14:12 -0500 |
---|---|---|
committer | swirl <swurl@swurl.xyz> | 2022-02-03 14:14:12 -0500 |
commit | 076efc4cb2586edbc11868bd93f48cfe03eb5a6d (patch) | |
tree | c525883696e42d8b3e2253e1b2eb08d43883abc6 /launcher/MMCZip.h | |
parent | 2c62a34c2f47961e343b8aae37cd76ed7520593e (diff) | |
parent | c4cb7ddc4f9c06006d585ba7ff7405ac0cfdbb3c (diff) | |
download | PrismLauncher-076efc4cb2586edbc11868bd93f48cfe03eb5a6d.tar.gz PrismLauncher-076efc4cb2586edbc11868bd93f48cfe03eb5a6d.tar.bz2 PrismLauncher-076efc4cb2586edbc11868bd93f48cfe03eb5a6d.zip |
Merge branch 'update-quazip' of git://github.com/Scrumplex/PolyMC into develop
Diffstat (limited to 'launcher/MMCZip.h')
-rw-r--r-- | launcher/MMCZip.h | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/launcher/MMCZip.h b/launcher/MMCZip.h index 9c47fa11..0f7aa254 100644 --- a/launcher/MMCZip.h +++ b/launcher/MMCZip.h @@ -21,17 +21,36 @@ #include "minecraft/mod/Mod.h" #include <functional> -#include <JlCompress.h> +#include <quazip/JlCompress.h> #include <nonstd/optional> namespace MMCZip { + using FilterFunction = std::function<bool(const QString &)>; /** * Merge two zip files, using a filter function */ bool mergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString> &contained, - const JlCompress::FilterFunction filter = nullptr); + const FilterFunction filter = nullptr); + + /** + * Compress directory, by providing a list of files to compress + * \param zip target archive + * \param dir directory that will be compressed (to compress with relative paths) + * \param files list of files to compress + * \return true for success or false for failure + */ + bool compressDirFiles(QuaZip *zip, QString dir, QFileInfoList files); + + /** + * Compress directory, by providing a list of files to compress + * \param fileCompressed target archive file + * \param dir directory that will be compressed (to compress with relative paths) + * \param files list of files to compress + * \return true for success or false for failure + */ + bool compressDirFiles(QString fileCompressed, QString dir, QFileInfoList files); /** * take a source jar, add mods to it, resulting in target jar @@ -89,4 +108,13 @@ namespace MMCZip */ bool extractFile(QString fileCompressed, QString file, QString dir); + /** + * Populate a QFileInfoList with a directory tree recursively, while allowing to excludeFilter what shouldn't be included. + * \param rootDir directory to start off + * \param subDir subdirectory, should be nullptr for first invocation + * \param files resulting list of QFileInfo + * \param excludeFilter function to excludeFilter which files shouldn't be included (returning true means to excude) + * \return true for success or false for failure + */ + bool collectFileListRecursively(const QString &rootDir, const QString &subDir, QFileInfoList *files, FilterFunction excludeFilter); } |