From efa414c442a77735a5f972b7103e8ce866a6bdd1 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Thu, 20 Jan 2022 20:40:56 +0100 Subject: refactor: initial migration to QuaZip 1.2 Let's move off our custom QuaZip. In the olden times we needed the custom version of QuaZip, as it was basically unmaintained and on SourceForge (eww). But nowadays it's maintained and on GitHub. See new GitHub page: https://github.com/stachenov/quazip --- launcher/ui/dialogs/ExportInstanceDialog.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'launcher/ui') diff --git a/launcher/ui/dialogs/ExportInstanceDialog.cpp b/launcher/ui/dialogs/ExportInstanceDialog.cpp index 1a164875..59ae0a76 100644 --- a/launcher/ui/dialogs/ExportInstanceDialog.cpp +++ b/launcher/ui/dialogs/ExportInstanceDialog.cpp @@ -378,6 +378,7 @@ void SaveIcon(InstancePtr m_instance) bool ExportInstanceDialog::doExport() { + /* auto name = FS::RemoveInvalidFilenameChars(m_instance->name()); const QString output = QFileDialog::getSaveFileName( @@ -404,11 +405,11 @@ bool ExportInstanceDialog::doExport() auto & blocked = proxyModel->blockedPaths(); using std::placeholders::_1; if (!JlCompress::compressDir(output, m_instance->instanceRoot(), name, std::bind(&SeparatorPrefixTree<'/'>::covers, blocked, _1))) - { + { */ QMessageBox::warning(this, tr("Error"), tr("Unable to export instance")); return false; - } - return true; + /*} + return true;*/ } void ExportInstanceDialog::done(int result) -- cgit From 81c72c2038f35e744e038923105d91add5a0732c Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Mon, 24 Jan 2022 23:02:06 +0100 Subject: refactor: bring back methods that need to be reimplemented --- launcher/ui/dialogs/ExportInstanceDialog.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'launcher/ui') diff --git a/launcher/ui/dialogs/ExportInstanceDialog.cpp b/launcher/ui/dialogs/ExportInstanceDialog.cpp index 59ae0a76..fb9c6542 100644 --- a/launcher/ui/dialogs/ExportInstanceDialog.cpp +++ b/launcher/ui/dialogs/ExportInstanceDialog.cpp @@ -378,7 +378,6 @@ void SaveIcon(InstancePtr m_instance) bool ExportInstanceDialog::doExport() { - /* auto name = FS::RemoveInvalidFilenameChars(m_instance->name()); const QString output = QFileDialog::getSaveFileName( @@ -404,12 +403,15 @@ bool ExportInstanceDialog::doExport() auto & blocked = proxyModel->blockedPaths(); using std::placeholders::_1; + QMessageBox::warning(this, tr("Error"), tr("Unable to export instance")); + return false; + // TODO Reimplement custom compressDir: if (!JlCompress::compressDir(output, m_instance->instanceRoot(), name, std::bind(&SeparatorPrefixTree<'/'>::covers, blocked, _1))) - { */ + { QMessageBox::warning(this, tr("Error"), tr("Unable to export instance")); return false; - /*} - return true;*/ + } + return true; } void ExportInstanceDialog::done(int result) -- cgit From a8089b76c0e7961e31b96cdd203e3c345183645b Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Fri, 28 Jan 2022 12:37:22 +0100 Subject: fix: bring back instance exports --- launcher/ui/dialogs/ExportInstanceDialog.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'launcher/ui') diff --git a/launcher/ui/dialogs/ExportInstanceDialog.cpp b/launcher/ui/dialogs/ExportInstanceDialog.cpp index fb9c6542..f3bf7abe 100644 --- a/launcher/ui/dialogs/ExportInstanceDialog.cpp +++ b/launcher/ui/dialogs/ExportInstanceDialog.cpp @@ -403,10 +403,13 @@ bool ExportInstanceDialog::doExport() auto & blocked = proxyModel->blockedPaths(); using std::placeholders::_1; - QMessageBox::warning(this, tr("Error"), tr("Unable to export instance")); - return false; - // TODO Reimplement custom compressDir: - if (!JlCompress::compressDir(output, m_instance->instanceRoot(), name, std::bind(&SeparatorPrefixTree<'/'>::covers, blocked, _1))) + auto files = QFileInfoList(); + if (!MMCZip::collectFileListRecursively(m_instance->instanceRoot(), nullptr, &files, + std::bind(&SeparatorPrefixTree<'/'>::covers, blocked, _1))) { + QMessageBox::warning(this, tr("Error"), tr("Unable to export instance")); + return false; + } + if (!MMCZip::compressDirFiles(output, m_instance->instanceRoot(), files)) { QMessageBox::warning(this, tr("Error"), tr("Unable to export instance")); return false; -- cgit