summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Ponomarev <[email protected]>2018-11-03 22:59:40 +0200
committerraveit65 <[email protected]>2019-07-30 10:12:49 +0200
commite1df6882d62bb1f0c700f3ee2d480c32d988eab5 (patch)
tree05c0dbfe9c8b82150b5126c7601003f39f19565e /src
parent770306b068d930b804cc1a62ce66fc5b87c8c8cd (diff)
downloadengrampa-e1df6882d62bb1f0c700f3ee2d480c32d988eab5.tar.bz2
engrampa-e1df6882d62bb1f0c700f3ee2d480c32d988eab5.tar.xz
Add zcompress support
Diffstat (limited to 'src')
-rw-r--r--src/fr-command-cfile.c23
-rw-r--r--src/fr-init.c2
2 files changed, 25 insertions, 0 deletions
diff --git a/src/fr-command-cfile.c b/src/fr-command-cfile.c
index 9b855a8..e71ea65 100644
--- a/src/fr-command-cfile.c
+++ b/src/fr-command-cfile.c
@@ -299,6 +299,14 @@ fr_command_cfile_add (FrCommand *comm,
compressed_filename = g_strconcat (filename, ".rz", NULL);
}
+ else if (is_mime_type (comm->mime_type, "application/zstd")) {
+ fr_process_begin_command (comm->process, "zstd");
+ fr_process_set_working_dir (comm->process, temp_dir);
+ fr_process_add_arg (comm->process, filename);
+ fr_process_end_command (comm->process);
+ compressed_filename = g_strconcat (filename, ".zst", NULL);
+ }
+
/* copy compressed file to the dest dir */
fr_process_begin_command (comm->process, "cp");
@@ -436,6 +444,14 @@ fr_command_cfile_extract (FrCommand *comm,
fr_process_end_command (comm->process);
}
+ else if (is_mime_type (comm->mime_type, "application/zstd")) {
+ fr_process_begin_command (comm->process, "zstd");
+ 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);
+ }
+
/* copy uncompress file to the dest dir */
uncompr_file = remove_extension_from_path (temp_file);
@@ -515,6 +531,7 @@ const char *cfile_mime_type[] = { "application/x-gzip",
"application/x-lzop",
"application/x-rzip",
"application/x-xz",
+ "application/zstd",
NULL };
@@ -571,6 +588,10 @@ fr_command_cfile_get_capabilities (FrCommand *comm,
if (is_program_available ("rzip", check_command))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
}
+ else if (is_mime_type (mime_type, "application/zstd")) {
+ if (is_program_available ("zstd", check_command))
+ capabilities |= FR_COMMAND_CAN_READ_WRITE;
+ }
return capabilities;
}
@@ -610,6 +631,8 @@ fr_command_cfile_get_packages (FrCommand *comm,
return PACKAGES ("lzop");
else if (is_mime_type (mime_type, "application/x-rzip"))
return PACKAGES ("rzip");
+ else if (is_mime_type (mime_type, "application/zstd"))
+ return PACKAGES ("zstd");
return NULL;
}
diff --git a/src/fr-init.c b/src/fr-init.c
index c7c1995..748c79a 100644
--- a/src/fr-init.c
+++ b/src/fr-init.c
@@ -111,6 +111,7 @@ FrMimeTypeDescription mime_type_desc[] = {
{ "application/x-xz-compressed-tar", ".tar.xz", N_("Tar compressed with xz (.tar.xz)"), 0 },
{ "application/x-zoo", ".zoo", N_("Zoo (.zoo)"), 0 },
{ "application/zip", ".zip", N_("Zip (.zip)"), 0 },
+ { "application/zstd", ".zst", N_("Zstandard (.zst)"), 0 },
{ NULL, NULL, NULL, 0 }
};
@@ -180,6 +181,7 @@ FrExtensionType file_ext_type[] = {
{ ".Z", "application/x-compress" },
{ ".zip", "application/zip" },
{ ".zoo", "application/x-zoo" },
+ { ".zst", "application/zstd" },
{ NULL, NULL }
};