Rewrite 7z uncompressing to work on all supported platforms

On Windows we ship 7za.exe in our binaries.
On MacOS we do the same, but the executable needs to be called with the full path.
On Linux we don't ship anything but assume it to be available from the distribution.
This commit is contained in:
Roland Rossgotterer
2018-11-20 14:12:19 +01:00
committed by Klaus Basan
parent 2843e20d54
commit 659b78832e
4 changed files with 75 additions and 68 deletions

View File

@@ -16,19 +16,23 @@
#include <QByteArray>
#include <QStringList>
class QProcess;
namespace BlackMisc
{
//! Compress utilities
class BLACKMISC_EXPORT CCompressUtils
{
public:
CCompressUtils() = delete;
//! Length header
//! \remark 4 bytes -> 32bit
static QByteArray lengthHeader(qint32 size);
//! Unzip my using 7zip
//! \remark relies on external 7zip command line
static bool zip7Uncompress(const QString &file, const QString &directory, bool wait, QStringList *stdOutAndError = nullptr);
static bool zip7Uncompress(const QString &file, const QString &directory, QStringList *stdOutAndError = nullptr);
//! External program existing?
//! \remark relies on external 7zip command line
@@ -39,9 +43,10 @@ namespace BlackMisc
static bool whichZip7(QStringList *stdOutAndError = nullptr);
private:
//! Ctor
CCompressUtils() {}
static bool runZip7Process(QProcess *zipProcess, QStringList *stdOutAndError);
};
} // ns
#endif // guard