summaryrefslogtreecommitdiff
path: root/src/fr-command-tar.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-09-15 23:30:48 +0200
committerlukefromdc <[email protected]>2019-10-03 03:31:21 +0000
commit62e3fa54b0770ae4cb789688952b7013a3df28e6 (patch)
tree1c93080341a18c64b2bd7182e67f19fce9290c4b /src/fr-command-tar.c
parentd054028b841d3f29fbe7f9bd57163ce4d125794f (diff)
downloadengrampa-62e3fa54b0770ae4cb789688952b7013a3df28e6.tar.bz2
engrampa-62e3fa54b0770ae4cb789688952b7013a3df28e6.tar.xz
Zstandard: read .tar.zst files
$ tar cafv ~/test.tar.zst ~/test $ xdg-mime query filetype ~/test.tar.zst application/x-zstd-compressed-tar Test: $ CFLAGS="-g -O0" ./autogen.sh --enable-magic --enable-packagekit --prefix=/usr && make && sudo make install $ engrampa ~/test.tar.zst
Diffstat (limited to 'src/fr-command-tar.c')
-rw-r--r--src/fr-command-tar.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c
index 3c47399..ffa911d 100644
--- a/src/fr-command-tar.c
+++ b/src/fr-command-tar.c
@@ -827,6 +827,11 @@ get_uncompressed_name (FrCommandTar *c_tar,
if (file_extension_is (e_filename, ".tar.7z"))
new_name[l - 3] = 0;
}
+ else if (is_mime_type (comm->mime_type, "application/x-zstd-compressed-tar")) {
+ /* X.tar.zst --> X.tar */
+ if (file_extension_is (e_filename, ".tar.zst"))
+ new_name[l - 4] = 0;
+ }
return new_name;
}
@@ -980,6 +985,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-zstd-compressed-tar")) {
+ fr_process_begin_command (comm->process, "zstd");
+ 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);
+ }
}
c_tar->uncomp_filename = get_uncompressed_name (c_tar, tmp_name);
@@ -1009,6 +1022,7 @@ const char *tar_mime_types[] = { "application/x-compressed-tar",
"application/x-lzop-compressed-tar",
"application/x-tarz",
"application/x-xz-compressed-tar",
+ "application/x-zstd-compressed-tar",
NULL };
@@ -1084,6 +1098,10 @@ fr_command_tar_get_capabilities (FrCommand *comm,
}
}
}
+ else if (is_mime_type (mime_type, "application/x-zstd-compressed-tar")) {
+ if (is_program_available ("zstd", check_command))
+ capabilities |= FR_COMMAND_CAN_READ;
+ }
return capabilities;
}
@@ -1137,6 +1155,8 @@ fr_command_tar_get_packages (FrCommand *comm,
return PACKAGES ("tar,lzop");
else if (is_mime_type (mime_type, "application/x-7z-compressed-tar"))
return PACKAGES ("tar,p7zip");
+ else if (is_mime_type (mime_type, "application/x-zstd-compressed-tar"))
+ return PACKAGES ("tar,zstd");
return NULL;
}