Skip to content
Permalink
Browse files

Added support for brotli (*.tar.br) compressed tar archives

  • Loading branch information...
stokito committed Nov 10, 2018
1 parent f06c216 commit fa96f93fbc43516a53a3efac4a52ae7745e61cdc
Showing with 52 additions and 5 deletions.
  1. +3 −2 README
  2. +1 −0 caja/caja-engrampa.c
  3. +3 −2 data/engrampa.appdata.xml.in
  4. +1 −1 data/engrampa.desktop.in.in
  5. +42 −0 src/fr-command-tar.c
  6. +2 −0 src/fr-init.c
5 README
@@ -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

@@ -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 },
@@ -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.
@@ -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
@@ -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"))
@@ -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" },

0 comments on commit fa96f93

Please sign in to comment.
You can’t perform that action at this time.