[file-roller] Added support for brotli (*.br) compressed files
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] Added support for brotli (*.br) compressed files
- Date: Fri, 11 Jan 2019 09:49:22 +0000 (UTC)
commit 860fc15be31743b5d5703ce874ca2141fa7ccbef
Author: Sergey Ponomarev <stokito gmail com>
Date: Sat Nov 10 13:41:55 2018 +0200
Added support for brotli (*.br) compressed files
README | 2 +-
data/packages.match | 1 +
data/supported-mime-types | 1 +
nautilus/nautilus-fileroller.c | 2 ++
src/fr-command-cfile.c | 23 +++++++++++++++++++++++
src/fr-init.c | 2 ++
6 files changed, 30 insertions(+), 1 deletion(-)
---
diff --git a/README b/README
index 73827fd2..9fffb7b2 100644
--- a/README
+++ b/README
@@ -47,7 +47,7 @@
* 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, bzip, bzip2, compress, lrzip, lzip,
lzop, rzip, xz.
* Home Page
diff --git a/data/packages.match b/data/packages.match
index 78b9fe38..4d80a4d6 100644
--- a/data/packages.match
+++ b/data/packages.match
@@ -1,6 +1,7 @@
[Package Matches]
arj=
binutils=
+brotli=
bzip2=
cpio=
dpkg=
diff --git a/data/supported-mime-types b/data/supported-mime-types
index 4e649538..7dad1f3e 100644
--- a/data/supported-mime-types
+++ b/data/supported-mime-types
@@ -10,6 +10,7 @@ application/x-alz;
application/x-ar;
application/x-archive;
application/x-arj;
+application/x-brotli;
application/x-bzip;
application/x-bzip-compressed-tar;
application/x-bzip1;
diff --git a/nautilus/nautilus-fileroller.c b/nautilus/nautilus-fileroller.c
index 441356bf..eb6e3e57 100644
--- a/nautilus/nautilus-fileroller.c
+++ b/nautilus/nautilus-fileroller.c
@@ -105,6 +105,7 @@ extract_here_callback (NautilusMenuItem *item,
g_string_free (cmd, TRUE);
}
+/** mime-types which aren't supported by nautilus itself */
static struct {
char *mime_type;
gboolean is_compressed;
@@ -113,6 +114,7 @@ static struct {
{ "application/x-alz", TRUE },
{ "application/x-ar", TRUE },
{ "application/x-arj", TRUE },
+ { "application/x-brotli", TRUE },
{ "application/vnd.ms-cab-compressed", TRUE },
{ "application/x-cbr", TRUE },
{ "application/x-cbz", TRUE },
diff --git a/src/fr-command-cfile.c b/src/fr-command-cfile.c
index 70cbb131..590546dd 100644
--- a/src/fr-command-cfile.c
+++ b/src/fr-command-cfile.c
@@ -239,6 +239,14 @@ fr_command_cfile_add (FrCommand *comm,
fr_process_end_command (comm->process);
compressed_filename = g_strconcat (filename, ".gz", NULL);
}
+ else if (_g_mime_type_matches (archive->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 (_g_mime_type_matches (archive->mime_type, "application/x-bzip")) {
fr_process_begin_command (comm->process, "bzip2");
fr_process_set_working_dir (comm->process, temp_dir);
@@ -391,6 +399,14 @@ fr_command_cfile_extract (FrCommand *comm,
fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
}
+ else if (_g_mime_type_matches (archive->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, "-f");
+ fr_process_add_arg (comm->process, "-d");
+ fr_process_add_arg (comm->process, temp_file);
+ fr_process_end_command (comm->process);
+ }
else if (_g_mime_type_matches (archive->mime_type, "application/x-bzip")) {
fr_process_begin_command (comm->process, "bzip2");
fr_process_set_working_dir (comm->process, temp_dir);
@@ -496,6 +512,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-lz4",
@@ -526,6 +543,10 @@ fr_command_cfile_get_capabilities (FrArchive *archive,
if (_g_program_is_available ("gzip", check_command))
capabilities |= FR_ARCHIVE_CAN_READ_WRITE;
}
+ else if (_g_mime_type_matches (mime_type, "application/x-brotli")) {
+ if (_g_program_is_available ("brotli", check_command))
+ capabilities |= FR_ARCHIVE_CAN_READ_WRITE;
+ }
else if (_g_mime_type_matches (mime_type, "application/x-bzip")) {
if (_g_program_is_available ("bzip2", check_command))
capabilities |= FR_ARCHIVE_CAN_READ_WRITE;
@@ -571,6 +592,8 @@ fr_command_cfile_get_packages (FrArchive *archive,
{
if (_g_mime_type_matches (mime_type, "application/x-gzip"))
return PACKAGES ("gzip");
+ else if (_g_mime_type_matches (mime_type, "application/x-brotli"))
+ return PACKAGES ("brotli");
else if (_g_mime_type_matches (mime_type, "application/x-bzip"))
return PACKAGES ("bzip2");
else if (_g_mime_type_matches (mime_type, "application/x-compress"))
diff --git a/src/fr-init.c b/src/fr-init.c
index 8bd089f7..750ab9ce 100644
--- a/src/fr-init.c
+++ b/src/fr-init.c
@@ -69,6 +69,7 @@ FrMimeTypeDescription mime_type_desc[] = {
{ "application/vnd.android.package-archive", ".apk", 0 },
{ "application/x-ar", ".ar", 0 },
{ "application/x-arj", ".arj", 0 },
+ { "application/x-brotli", ".br", 0 },
{ "application/x-bzip", ".bz2", 0 },
{ "application/x-bzip-compressed-tar", ".tar.bz2", 0 },
{ "application/x-bzip1", ".bz", 0 },
@@ -126,6 +127,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" },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]