From d95a7a4bb8d00a2e994bee82f4f64b2ed1d9ec12 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 14 Aug 2023 11:05:34 +0200 Subject: just-mr archives: Add 7zip support via autodetection option Similarly to tarballs, an autodetection option for zip-like archives is added to enable a unified handling of both traditional zip and 7zip formats. Thus, for "zip" archives just-mr uses now this autodetection option. --- src/other_tools/utils/archive_ops.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/other_tools/utils/archive_ops.cpp') diff --git a/src/other_tools/utils/archive_ops.cpp b/src/other_tools/utils/archive_ops.cpp index a0804abc..f0d02531 100644 --- a/src/other_tools/utils/archive_ops.cpp +++ b/src/other_tools/utils/archive_ops.cpp @@ -148,6 +148,10 @@ auto ArchiveOps::EnableWriteFormats(archive* aw, ArchiveType type) std::string(archive_error_string(aw)); } } break; + case ArchiveType::ZipAuto: { + return std::string( + "ArchiveOps: Writing a zip-like archive must be explicit"); + } case ArchiveType::Tar: case ArchiveType::TarGz: case ArchiveType::TarBz2: @@ -182,6 +186,16 @@ auto ArchiveOps::EnableReadFormats(archive* ar, ArchiveType type) std::string(archive_error_string(ar)); } } break; + case ArchiveType::ZipAuto: { + if (archive_read_support_format_7zip(ar) != ARCHIVE_OK) { + return std::string("ArchiveOps: ") + + std::string(archive_error_string(ar)); + } + if (archive_read_support_format_zip(ar) != ARCHIVE_OK) { + return std::string("ArchiveOps: ") + + std::string(archive_error_string(ar)); + } + } break; case ArchiveType::TarAuto: case ArchiveType::Tar: case ArchiveType::TarGz: -- cgit v1.2.3