diff --git a/autotests/kerfuffle/archivetest.cpp b/autotests/kerfuffle/archivetest.cpp --- a/autotests/kerfuffle/archivetest.cpp +++ b/autotests/kerfuffle/archivetest.cpp @@ -148,6 +148,12 @@ } else { qDebug() << "lrzip executable not found in path. Skipping lrzip test."; } + + QTest::newRow("xar archive") + << QFINDTESTDATA("data/simplearchive.xar") + << QStringLiteral("simplearchive") + << true << false << false << Archive::Unencrypted + << QStringLiteral("simplearchive"); } void ArchiveTest::testProperties() @@ -448,6 +454,23 @@ } else { qDebug() << "lrzip executable not found in path. Skipping lrzip test."; } + + archivePath = QFINDTESTDATA("data/simplearchive.xar"); + QTest::newRow("extract selected entries from a xar archive without path") + << archivePath + << QVariantList { + QVariant::fromValue(fileRootNodePair(QStringLiteral("dir1/file11.txt"), QString())), + QVariant::fromValue(fileRootNodePair(QStringLiteral("file4.txt"), QString())) + } + << ExtractionOptions() + << 2; + + archivePath = QFINDTESTDATA("data/simplearchive.xar"); + QTest::newRow("extract all entries from a xar archive with path") + << archivePath + << QVariantList() + << optionsPreservePaths + << 6; } void ArchiveTest::testExtraction() diff --git a/autotests/kerfuffle/mimetypetest.cpp b/autotests/kerfuffle/mimetypetest.cpp --- a/autotests/kerfuffle/mimetypetest.cpp +++ b/autotests/kerfuffle/mimetypetest.cpp @@ -58,6 +58,7 @@ const QString compressedLrzipTarMime = QStringLiteral("application/x-lrzip-compressed-tar"); const QString isoMimeType = QStringLiteral("application/x-cd-image"); const QString debMimeType = QMimeDatabase().mimeTypeForFile(QStringLiteral("dummy.deb"), QMimeDatabase::MatchExtension).name(); + const QString xarMimeType = QStringLiteral("application/x-xar"); QTest::newRow("empty name") << QString() << QStringLiteral("application/octet-stream"); QTest::newRow("tar.gz") << QFINDTESTDATA("data/simplearchive.tar.gz") << compressedGzipTarMime; @@ -69,6 +70,7 @@ QTest::newRow("tar.lzo") << QFINDTESTDATA("data/simplearchive.tar.lzo") << compressedLzopTarMime; QTest::newRow("tar.lrz") << QFINDTESTDATA("data/simplearchive.tar.lrz") << compressedLrzipTarMime; QTest::newRow("deb") << QFINDTESTDATA("data/smallarchive.deb") << debMimeType; + QTest::newRow("xar") << QFINDTESTDATA("data/simplearchive.xar") << xarMimeType; QTest::newRow("zip with wrong extension") << QFINDTESTDATA("data/zip_with_wrong_extension.rar") << QStringLiteral("application/zip"); QTest::newRow("tar with special char in the extension") << QStringLiteral("foo.tar~1.gz") << compressedGzipTarMime; diff --git a/kerfuffle/mime/kerfuffle.xml b/kerfuffle/mime/kerfuffle.xml --- a/kerfuffle/mime/kerfuffle.xml +++ b/kerfuffle/mime/kerfuffle.xml @@ -5,4 +5,12 @@ Tar archive (lzip-compressed) + + XAR archive + XAR + eXtensible ARchive + + + + diff --git a/plugins/libarchive/CMakeLists.txt b/plugins/libarchive/CMakeLists.txt --- a/plugins/libarchive/CMakeLists.txt +++ b/plugins/libarchive/CMakeLists.txt @@ -4,7 +4,7 @@ set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "application/x-tar;application/x-compressed-tar;application/x-bzip-compressed-tar;application/x-tarz;application/x-xz-compressed-tar;") set(SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES "${SUPPORTED_LIBARCHIVE_READWRITE_MIMETYPES}application/x-lzma-compressed-tar;application/x-lzip-compressed-tar;application/x-tzo;application/x-lrzip-compressed-tar;") set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "application/vnd.debian.binary-package;application/x-deb;application/x-cd-image;application/x-bcpio;application/x-cpio;application/x-cpio-compressed;application/x-sv4cpio;application/x-sv4crc;") -set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "${SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES}application/x-rpm;application/x-source-rpm;application/vnd.ms-cab-compressed;") +set(SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES "${SUPPORTED_LIBARCHIVE_READONLY_MIMETYPES}application/x-rpm;application/x-source-rpm;application/vnd.ms-cab-compressed;application/x-xar;") set(INSTALLED_LIBARCHIVE_PLUGINS "") diff --git a/plugins/libarchive/kerfuffle_libarchive_readonly.json b/plugins/libarchive/kerfuffle_libarchive_readonly.json --- a/plugins/libarchive/kerfuffle_libarchive_readonly.json +++ b/plugins/libarchive/kerfuffle_libarchive_readonly.json @@ -24,7 +24,8 @@ "application/x-rpm", "application/x-source-rpm", "application/vnd.debian.binary-package", - "application/vnd.ms-cab-compressed" + "application/vnd.ms-cab-compressed", + "application/x-xar" ], "Name": "kerfuffle_libarchive_readonly", "Name[sv]": "Kerfuffle LibArchive skrivskyddat",