Skip to content
Permalink
Browse files

Add brotli support

  • Loading branch information...
stokito authored and sponomarev committed Oct 30, 2018
1 parent 8ef808e commit f06c2164fbc7b0e890fd2efdb05c0516f5ad3142
Showing with 31 additions and 4 deletions.
  1. +2 −2 README
  2. +1 −0 caja/caja-engrampa.c
  3. +1 −1 data/engrampa.appdata.xml.in
  4. +1 −1 data/engrampa.desktop.in.in
  5. +1 −0 data/packages.match
  6. +1 −0 src/fr-archive.c
  7. +22 −0 src/fr-command-cfile.c
  8. +2 −0 src/fr-init.c
4 README
@@ -47,12 +47,12 @@
* ZIP Archive (.zip)
* ZIP Archived Comic Book (.cbz)
* ZOO Compressed Archive File (.zoo)
* Single files compressed with gzip, bzip, bzip2, compress, lrzip, lzip,
* Single files compressed with gzip, brotli (.br), bzip, bzip2, compress, lrzip, lzip,
lzop, rzip, xz.

* Home Page

http://www.mate-desktop.org/
https://mate-desktop.org/

* Licensing

@@ -159,6 +159,7 @@ static struct {
{ "application/x-alz", TRUE },
{ "application/x-ar", TRUE },
{ "application/x-arj", TRUE },
{ "application/x-brotli", TRUE },
{ "application/x-bzip", TRUE },
{ "application/x-bzip-compressed-tar", TRUE },
{ "application/x-bzip1", TRUE },
@@ -33,7 +33,7 @@
<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), bzip (.tar.bz, .tbz), bzip2 (.tar.bz2, .tbz2),
<li>Tape Archive File uncompressed (.tar) or compressed with: gzip (.tar.gz, .tgz), brotli (.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>
@@ -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-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-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
@@ -1,6 +1,7 @@
[Package Matches]
arj=
binutils=
brotli=
bzip2=
cpio=
dpkg=
@@ -552,6 +552,7 @@ get_mime_type_from_magic_numbers (GFile *file)
{ 0, 6, "7z\274\257\047\034", "application/x-7z-compressed" },
{ 7, 7, "**ACE**", "application/x-ace" },
{ 0, 2, "\x60\xea", "application/x-arj" },
{ 0, 4, "\xce\xb2\xcf\x81", "application/x-brotli" },
{ 0, 3, "BZh", "application/x-bzip2" },
{ 0, 2, "\037\213", "application/x-gzip" },
{ 0, 4, "LZIP", "application/x-lzip" },
@@ -233,6 +233,14 @@ fr_command_cfile_add (FrCommand *comm,
fr_process_end_command (comm->process);
compressed_filename = g_strconcat (filename, ".gz", NULL);
}
else if (is_mime_type (comm->mime_type, "application/x-brotli")) {
fr_process_begin_command (comm->process, "brotli");
fr_process_set_working_dir (comm->process, temp_dir);
fr_process_add_arg (comm->process, "--");
fr_process_add_arg (comm->process, filename);
fr_process_end_command (comm->process);
compressed_filename = g_strconcat (filename, ".br", NULL);
}
else if (is_mime_type (comm->mime_type, "application/x-bzip")) {
fr_process_begin_command (comm->process, "bzip2");
fr_process_set_working_dir (comm->process, temp_dir);
@@ -364,6 +372,13 @@ fr_command_cfile_extract (FrCommand *comm,
fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
}
else if (is_mime_type (comm->mime_type, "application/x-brotli")) {
fr_process_begin_command (comm->process, "brotli");
fr_process_add_arg (comm->process, "-f");
fr_process_add_arg (comm->process, "-d");
fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
}
else if (is_mime_type (comm->mime_type, "application/x-bzip")) {
fr_process_begin_command (comm->process, "bzip2");
fr_process_add_arg (comm->process, "-f");
@@ -456,6 +471,7 @@ fr_command_cfile_extract (FrCommand *comm,


const char *cfile_mime_type[] = { "application/x-gzip",
"application/x-brotli",
"application/x-bzip",
"application/x-compress",
"application/x-lzip",
@@ -485,6 +501,10 @@ fr_command_cfile_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")) {
if (is_program_available ("brotli", check_command))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
}
else if (is_mime_type (mime_type, "application/x-bzip")) {
if (is_program_available ("bzip2", check_command))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
@@ -538,6 +558,8 @@ fr_command_cfile_get_packages (FrCommand *comm,
{
if (is_mime_type (mime_type, "application/x-gzip"))
return PACKAGES ("gzip");
else if (is_mime_type (mime_type, "application/x-brotli"))
return PACKAGES ("brotli");
else if (is_mime_type (mime_type, "application/x-bzip"))
return PACKAGES ("bzip2");
else if (is_mime_type (mime_type, "application/x-compress"))
@@ -65,6 +65,7 @@ FrMimeTypeDescription mime_type_desc[] = {
{ "application/x-ar", ".a", N_("Ar (.a)"), 0 },
{ "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-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 },
@@ -119,6 +120,7 @@ FrExtensionType file_ext_type[] = {
{ ".ar", "application/x-ar" },
{ ".arj", "application/x-arj" },
{ ".bin", "application/x-stuffit" },
{ ".br", "application/x-brotli" },
{ ".bz", "application/x-bzip" },
{ ".bz2", "application/x-bzip" },
{ ".cab", "application/vnd.ms-cab-compressed" },

0 comments on commit f06c216

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