Skip to content

Commit

Permalink
Small fixes. LibAarchive.hpp renamed to libarchiveqt.h. Added install…
Browse files Browse the repository at this point in the history
… code
  • Loading branch information
marcusbritanicus committed Mar 21, 2016
1 parent 3cb56b5 commit 91a39b0
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 121 deletions.
105 changes: 0 additions & 105 deletions example/Main.cpp

This file was deleted.

3 changes: 2 additions & 1 deletion example/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <unistd.h>

// LibArchive
#include <LibArchive.hpp>
#include <libarchiveqt.h>

QString formatSize( qint64 num ) {

Expand Down Expand Up @@ -110,6 +110,7 @@ int main( int argc, char** argv ) {
else if ( !strcmp( argv[ 1 ], "-l" ) ) {
// List archive code
LibArchive *arc = new LibArchive( argv[ 2 ] );
qDebug() << arc->list().count();
Q_FOREACH( ArchiveEntry *ae, arc->list() ) {
if ( ae->type == AE_IFREG )
qDebug() << ae->name.toLocal8Bit().data() << formatSize( ae->size ).toLocal8Bit().data();
Expand Down
2 changes: 1 addition & 1 deletion example/example.pro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ INCLUDEPATH += . ../lib/
LIBS += -L../lib/ -larchiveqt

# Input
SOURCES += Main.cpp
SOURCES += example.cpp

CONFIG += silent warn_on
QT -= gui
Expand Down
3 changes: 3 additions & 0 deletions lib/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Version 1.0.0
- First release
- Supports Gzip, BZip2, LZMA, LZMA2, Cpio, AR, ISO9660, PAX, Shar, Zip, 7Zip, Tar formats
13 changes: 12 additions & 1 deletion lib/LibArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@
*/

#include <Global.hpp>
#include <LibArchive.hpp>
#include <libarchiveqt.h>

#include <LibLzma.hpp>
#include <LibLzma2.hpp>
#include <LibBZip2.hpp>
#include <LibGZip.hpp>

// SystemWide Headers
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>

inline static bool isDir( QString path ) {

Expand Down
28 changes: 28 additions & 0 deletions lib/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
libarchive-qt
A Qt based archiving solution with libarchive backend

This is a simple archiving library for Qt.
Currently it supports the following archive/compression formats

- Gzip
- BZip2
- LZMA
- LZMA2
- Cpio
- AR
- ISO9660
- PAX
- Shar
- Zip
- 7Zip
- Tar

This is a library that I whipped up in a few hours and hence may contain bugs. Please open an "Issue" in "github" if you find one.
If you know the fix, please contribute.

Several other filters such as grzip, lrzip, lzip, lzop are supported by the libarchive, but not by this library.
If and when I find time and knowledge to add those filters I shall do so.

Those who know to add these and other filters to this library, are welcome to do so. :)

*Note:* My libarchive version is 3.1.2
22 changes: 21 additions & 1 deletion lib/lib.pro
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
TEMPLATE = lib
TARGET = archiveqt

greaterThan(QT_MAJOR_VERSION, 4) {
TARGET = archiveqt5
}

DEPENDPATH += . MimeHandler StandardPaths
INCLUDEPATH += . MimeHandler StandardPaths

LIBS += -larchive -lz -lbz2 -llzma

# Input
HEADERS += LibArchive.hpp LibLzma.hpp LibLzma2.hpp LibBZip2.hpp LibGZip.hpp
HEADERS += libarchiveqt.h LibLzma.hpp LibLzma2.hpp LibBZip2.hpp LibGZip.hpp
SOURCES += LibArchive.cpp LibLzma.cpp LibLzma2.cpp LibBZip2.cpp LibGZip.cpp

# MimeType handling + QStandardPaths
Expand All @@ -23,3 +27,19 @@ MOC_DIR = ../build/moc-X
OBJECTS_DIR = ../build/obj-X
RCC_DIR = ../build/qrc-X
UI_DIR = ../build/uic-X

unix {
isEmpty(PREFIX) {
PREFIX = /usr
}

INSTALLS += target includes

target.path = $$PREFIX/lib/

includes.path = $$PREFIX/include/
includes.files = libarchive.h

data.path = $$PREFIX/share/libarchiveqt/
data.files = README Changelog ReleaseNotes
}
34 changes: 22 additions & 12 deletions lib/LibArchive.hpp → lib/libarchiveqt.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
/*
*
* LibArchive.hpp - LibArchive.cpp header
* Copyright 2016 Britanicus <[email protected]>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/

Expand All @@ -13,17 +34,6 @@
// Qt Headers
#include <QtCore>

// SystemWide Headers
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>

#include <LibLzma.hpp>
#include <LibLzma2.hpp>
#include <LibBZip2.hpp>
#include <LibGZip.hpp>

class QMimeType;

typedef struct {
Expand Down

0 comments on commit 91a39b0

Please sign in to comment.