diff options
author | Sergey Ponomarev <[email protected]> | 2018-11-10 15:56:12 +0200 |
---|---|---|
committer | Sergey Ponomarev <[email protected]> | 2018-11-10 15:56:12 +0200 |
commit | fa96f93fbc43516a53a3efac4a52ae7745e61cdc (patch) | |
tree | bc8a9200762b1b842fbea49eceb915232b72c15e | |
parent | f06c2164fbc7b0e890fd2efdb05c0516f5ad3142 (diff) | |
download | engrampa-fa96f93fbc43516a53a3efac4a52ae7745e61cdc.tar.bz2 engrampa-fa96f93fbc43516a53a3efac4a52ae7745e61cdc.tar.xz |
Added support for brotli (*.tar.br) compressed tar archives
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | caja/caja-engrampa.c | 1 | ||||
-rw-r--r-- | data/engrampa.appdata.xml.in | 5 | ||||
-rw-r--r-- | data/engrampa.desktop.in.in | 2 | ||||
-rw-r--r-- | src/fr-command-tar.c | 42 | ||||
-rw-r--r-- | src/fr-init.c | 2 |
6 files changed, 52 insertions, 5 deletions
@@ -35,6 +35,7 @@ * uncompressed (.tar) or compressed with: * gzip (.tar.gz , .tgz) + * brotli (.tar.br) * bzip (.tar.bz , .tbz) * bzip2 (.tar.bz2 , .tbz2) * compress (.tar.Z , .taz) @@ -47,8 +48,8 @@ * ZIP Archive (.zip) * ZIP Archived Comic Book (.cbz) * ZOO Compressed Archive File (.zoo) - * Single files compressed with gzip, brotli (.br), bzip, bzip2, compress, lrzip, lzip, - lzop, rzip, xz. + * Single files compressed with gzip (.gz), brotli (.br), bzip (.bz), bzip2 (.bz2), compress (.Z), + lrzip (.lrz), lzip (.lz), lzop (.lzo), rzip(.rz), xz (.xz). * Home Page diff --git a/caja/caja-engrampa.c b/caja/caja-engrampa.c index 01f117a..3c14369 100644 --- a/caja/caja-engrampa.c +++ b/caja/caja-engrampa.c @@ -160,6 +160,7 @@ static struct { { "application/x-ar", TRUE }, { "application/x-arj", TRUE }, { "application/x-brotli", TRUE }, + { "application/x-brotli-compressed-tar", TRUE }, { "application/x-bzip", TRUE }, { "application/x-bzip-compressed-tar", TRUE }, { "application/x-bzip1", TRUE }, diff --git a/data/engrampa.appdata.xml.in b/data/engrampa.appdata.xml.in index 999d6b3..b176e71 100644 --- a/data/engrampa.appdata.xml.in +++ b/data/engrampa.appdata.xml.in @@ -33,14 +33,15 @@ <li>WinRAR Compressed Archive (.rar)</li> <li>RAR Archived Comic Book (.cbr)</li> <li>RPM Linux Package (.rpm) [Read-only mode]</li> - <li>Tape Archive File uncompressed (.tar) or compressed with: gzip (.tar.gz, .tgz), brotli (.br), bzip (.tar.bz, .tbz), bzip2 (.tar.bz2, .tbz2), + <li>Tape Archive File uncompressed (.tar) or compressed with: gzip (.tar.gz, .tgz), brotli (.tar.br), bzip (.tar.bz, .tbz), bzip2 (.tar.bz2, .tbz2), compress (.tar.Z, .taz), lrzip (.tar.lrz, .tlrz), lzip (.tar.lz, .tlz), lzop (.tar.lzo, .tzo), 7zip (.tar.7z), xz (.tar.xz) </li> <li>Stuffit Archives (.bin, .sit)</li> <li>ZIP Archive (.zip)</li> <li>ZIP Archived Comic Book (.cbz)</li> <li>ZOO Compressed Archive File (.zoo)</li> - <li>Single files compressed with gzip, bzip, bzip2, compress, lrzip, lzip, lzop, rzip, xz</li> + <li>Single files compressed with gzip (.gz), brotli (.br), bzip (.bz), bzip2 (.bz2), compress (.Z), + lrzip (.lrz), lzip (.lz), lzop (.lzo), rzip(.rz), xz (.xz).</li> </ul> <p> Engrampa is a fork of File Roller and part of the MATE Desktop Environment. diff --git a/data/engrampa.desktop.in.in b/data/engrampa.desktop.in.in index f6aa477..c99fff7 100644 --- a/data/engrampa.desktop.in.in +++ b/data/engrampa.desktop.in.in @@ -9,7 +9,7 @@ Terminal=false Type=Application Icon=engrampa Categories=GTK;Utility;Archiving;Compression; -MimeType=application/x-7z-compressed;application/x-7z-compressed-tar;application/x-ace;application/x-alz;application/x-ar;application/x-arj;application/x-brotli;application/x-bzip;application/x-bzip-compressed-tar;application/x-bzip1;application/x-bzip1-compressed-tar;application/x-cabinet;application/x-cbr;application/x-cbz;application/x-cd-image;application/x-compress;application/x-compressed-tar;application/x-cpio;application/x-deb;application/x-ear;application/x-ms-dos-executable;application/x-gtar;application/x-gzip;application/x-gzpostscript;application/x-java-archive;application/x-lha;application/x-lhz;application/x-lrzip;application/x-lrzip-compressed-tar;application/x-lzip;application/x-lzip-compressed-tar;application/x-lzma;application/x-lzma-compressed-tar;application/x-lzop;application/x-lzop-compressed-tar;application/x-ms-wim;application/x-rar;application/x-rar-compressed;application/x-rpm;application/x-rzip;application/x-tar;application/x-tarz;application/x-stuffit;application/x-war;application/x-xz;application/x-xz-compressed-tar;application/x-zip;application/x-zip-compressed;application/x-zoo;application/zip;application/x-archive;application/vnd.ms-cab-compressed; +MimeType=application/x-7z-compressed;application/x-7z-compressed-tar;application/x-ace;application/x-alz;application/x-ar;application/x-arj;application/x-brotli;application/x-brotli-compressed-tar;application/x-bzip;application/x-bzip-compressed-tar;application/x-bzip1;application/x-bzip1-compressed-tar;application/x-cabinet;application/x-cbr;application/x-cbz;application/x-cd-image;application/x-compress;application/x-compressed-tar;application/x-cpio;application/x-deb;application/x-ear;application/x-ms-dos-executable;application/x-gtar;application/x-gzip;application/x-gzpostscript;application/x-java-archive;application/x-lha;application/x-lhz;application/x-lrzip;application/x-lrzip-compressed-tar;application/x-lzip;application/x-lzip-compressed-tar;application/x-lzma;application/x-lzma-compressed-tar;application/x-lzop;application/x-lzop-compressed-tar;application/x-ms-wim;application/x-rar;application/x-rar-compressed;application/x-rpm;application/x-rzip;application/x-tar;application/x-tarz;application/x-stuffit;application/x-war;application/x-xz;application/x-xz-compressed-tar;application/x-zip;application/x-zip-compressed;application/x-zoo;application/zip;application/x-archive;application/vnd.ms-cab-compressed; Keywords=MATE;archive;manager;compression; X-MATE-DocPath=engrampa/engrampa.xml X-MATE-Bugzilla-Bugzilla=MATE diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c index c6dbd9b..dc12f64 100644 --- a/src/fr-command-tar.c +++ b/src/fr-command-tar.c @@ -197,6 +197,9 @@ add_compress_arg (FrCommand *comm) if (is_mime_type (comm->mime_type, "application/x-compressed-tar")) fr_process_add_arg (comm->process, "-z"); + else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar")) + fr_process_add_arg (comm->process, "--use-compress-program=brotli"); + else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar")) if (is_program_in_path ("lbzip2")) fr_process_add_arg (comm->process, "--use-compress-program=lbzip2"); @@ -544,6 +547,25 @@ fr_command_tar_recompress (FrCommand *comm) new_name = g_strconcat (c_tar->uncomp_filename, ".gz", NULL); } + else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar")) { + fr_process_begin_command (comm->process, "brotli"); + fr_process_set_begin_func (comm->process, begin_func__recompress, comm); + switch (comm->compression) { + case FR_COMPRESSION_VERY_FAST: + fr_process_add_arg (comm->process, "-1"); break; + case FR_COMPRESSION_FAST: + fr_process_add_arg (comm->process, "-3"); break; + case FR_COMPRESSION_NORMAL: + fr_process_add_arg (comm->process, "-6"); break; + case FR_COMPRESSION_MAXIMUM: + fr_process_add_arg (comm->process, "--best"); break; // i.e. -q 11 + } + fr_process_add_arg (comm->process, "-f"); + fr_process_add_arg (comm->process, c_tar->uncomp_filename); + fr_process_end_command (comm->process); + + new_name = g_strconcat (c_tar->uncomp_filename, ".br", NULL); + } else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar")) { fr_process_begin_command (comm->process, "bzip2"); fr_process_set_begin_func (comm->process, begin_func__recompress, comm); @@ -757,6 +779,11 @@ get_uncompressed_name (FrCommandTar *c_tar, else if (file_extension_is (e_filename, ".tar.gz")) new_name[l - 3] = 0; } + else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar")) { + /* X.tar.br --> X.tar */ + if (file_extension_is (e_filename, ".tar.br")) + new_name[l - 3] = 0; + } else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar")) { /* X.tbz2 --> X.tar * X.tar.bz2 --> X.tar */ @@ -895,6 +922,14 @@ fr_command_tar_uncompress (FrCommand *comm) fr_process_add_arg (comm->process, tmp_name); fr_process_end_command (comm->process); } + else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar")) { + fr_process_begin_command (comm->process, "brotli"); + fr_process_set_begin_func (comm->process, begin_func__uncompress, comm); + fr_process_add_arg (comm->process, "-f"); + fr_process_add_arg (comm->process, "-d"); + fr_process_add_arg (comm->process, tmp_name); + fr_process_end_command (comm->process); + } else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar")) { fr_process_begin_command (comm->process, "bzip2"); fr_process_set_begin_func (comm->process, begin_func__uncompress, comm); @@ -992,6 +1027,7 @@ fr_command_tar_handle_error (FrCommand *comm, const char *tar_mime_types[] = { "application/x-compressed-tar", + "application/x-brotli-compressed-tar", "application/x-bzip-compressed-tar", "application/x-tar", "application/x-7z-compressed-tar", @@ -1031,6 +1067,10 @@ fr_command_tar_get_capabilities (FrCommand *comm, if (is_program_available ("gzip", check_command)) capabilities |= FR_COMMAND_CAN_READ_WRITE; } + else if (is_mime_type (mime_type, "application/x-brotli-compressed-tar")) { + if (is_program_available ("brotli", check_command)) + capabilities |= FR_COMMAND_CAN_READ_WRITE; + } else if (is_mime_type (mime_type, "application/x-bzip-compressed-tar")) { if (is_program_available ("bzip2", check_command)) capabilities |= FR_COMMAND_CAN_READ_WRITE; @@ -1109,6 +1149,8 @@ fr_command_tar_get_packages (FrCommand *comm, return PACKAGES ("tar,gzip"); else if (is_mime_type (mime_type, "application/x-bzip-compressed-tar")) return PACKAGES ("tar,bzip2"); + else if (is_mime_type (mime_type, "application/x-brotli-compressed-tar")) + return PACKAGES ("tar,brotli"); else if (is_mime_type (mime_type, "application/x-tarz")) return PACKAGES ("tar,gzip,ncompress"); else if (is_mime_type (mime_type, "application/x-lrzip-compressed-tar")) diff --git a/src/fr-init.c b/src/fr-init.c index 2927458..574bb48 100644 --- a/src/fr-init.c +++ b/src/fr-init.c @@ -66,6 +66,7 @@ FrMimeTypeDescription mime_type_desc[] = { { "application/x-ar", ".ar", N_("Ar (.ar)"), 0 }, { "application/x-arj", ".arj", N_("Arj (.arj)"), 0 }, { "application/x-brotli", ".br", N_("brotli (.br)"), 0 }, + { "application/x-brotli-compressed-tar", ".tar.br", N_("Tar compressed with brotli (.tar.br)"), 0 }, { "application/x-bzip", ".bz2", NULL, 0 }, { "application/x-bzip-compressed-tar", ".tar.bz2", N_("Tar compressed with bzip2 (.tar.bz2)"), 0 }, { "application/x-bzip1", ".bz", NULL, 0 }, @@ -151,6 +152,7 @@ FrExtensionType file_ext_type[] = { { ".sit", "application/x-stuffit" }, { ".swm", "application/x-ms-wim" }, { ".tar", "application/x-tar" }, + { ".tar.br", "application/x-brotli-compressed-tar" }, { ".tar.bz", "application/x-bzip-compressed-tar" }, { ".tar.bz2", "application/x-bzip-compressed-tar" }, { ".tar.gz", "application/x-compressed-tar" }, |