mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
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.
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
/* Copyright (C) 2018
|
|
* swift project Community / Contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
|
* contained in the LICENSE file.
|
|
*/
|
|
|
|
//! \file
|
|
|
|
#ifndef BLACKMISC_COMPRESSUTILS_H
|
|
#define BLACKMISC_COMPRESSUTILS_H
|
|
|
|
#include "blackmisc/blackmiscexport.h"
|
|
#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, QStringList *stdOutAndError = nullptr);
|
|
|
|
//! External program existing?
|
|
//! \remark relies on external 7zip command line
|
|
static bool hasZip7(QStringList *stdOutAndError = nullptr);
|
|
|
|
//! Uses which to determine if 7Zip exists
|
|
//! \remark for UNIX systems, using which
|
|
static bool whichZip7(QStringList *stdOutAndError = nullptr);
|
|
|
|
private:
|
|
static bool runZip7Process(QProcess *zipProcess, QStringList *stdOutAndError);
|
|
|
|
};
|
|
} // ns
|
|
|
|
#endif // guard
|
|
|