[file-roller] added support for lrzip compressed tar archives
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] added support for lrzip compressed tar archives
- Date: Mon, 3 May 2010 11:45:32 +0000 (UTC)
commit 06e49377828e8a95fcb0650e0a8ae386205167ae
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon May 3 13:39:09 2010 +0200
added support for lrzip compressed tar archives
src/fr-command-tar.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
src/main.c | 6 ++++--
2 files changed, 53 insertions(+), 2 deletions(-)
---
diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c
index 53ab601..030ae21 100644
--- a/src/fr-command-tar.c
+++ b/src/fr-command-tar.c
@@ -206,6 +206,9 @@ add_compress_arg (FrCommand *comm)
else
fr_process_add_arg (comm->process, "-Z");
}
+ else if (is_mime_type (comm->mime_type, "application/x-lrzip-compressed-tar"))
+ fr_process_add_arg (comm->process, "--use-compress-program=lrzip");
+
else if (is_mime_type (comm->mime_type, "application/x-lzip-compressed-tar"))
fr_process_add_arg (comm->process, "--use-compress-program=lzip");
@@ -558,6 +561,26 @@ fr_command_tar_recompress (FrCommand *comm)
new_name = g_strconcat (c_tar->uncomp_filename, ".Z", NULL);
}
+ else if (is_mime_type (comm->mime_type, "application/x-lrzip-compressed-tar")) {
+ fr_process_begin_command (comm->process, "lrzip");
+ fr_process_set_sticky (comm->process, TRUE);
+ 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, "-l"); break;
+ case FR_COMPRESSION_FAST:
+ fr_process_add_arg (comm->process, "-g"); break;
+ case FR_COMPRESSION_NORMAL:
+ fr_process_add_arg (comm->process, "-b"); break;
+ case FR_COMPRESSION_MAXIMUM:
+ fr_process_add_arg (comm->process, "-z"); break;
+ }
+ fr_process_add_arg (comm->process, "-o");
+ fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+ fr_process_end_command (comm->process);
+
+ new_name = g_strconcat (c_tar->uncomp_filename, ".lrz", NULL);
+ }
else if (is_mime_type (comm->mime_type, "application/x-lzip-compressed-tar")) {
fr_process_begin_command (comm->process, "lzip");
fr_process_set_sticky (comm->process, TRUE);
@@ -749,6 +772,17 @@ get_uncompressed_name (FrCommandTar *c_tar,
else if (file_extension_is (e_filename, ".tar.Z"))
new_name[l - 2] = 0;
}
+ else if (is_mime_type (comm->mime_type, "application/x-lrzip-compressed-tar")) {
+ /* X.tlrz --> X.tar
+ * X.tar.lrz --> X.tar */
+ if (file_extension_is (e_filename, ".tlrz")) {
+ new_name[l - 3] = 'a';
+ new_name[l - 2] = 'r';
+ new_name[l - 1] = 0;
+ }
+ else if (file_extension_is (e_filename, ".tar.lrz"))
+ new_name[l - 4] = 0;
+ }
else if (is_mime_type (comm->mime_type, "application/x-lzip-compressed-tar")) {
/* X.tlz --> X.tar
* X.tar.lz --> X.tar */
@@ -877,6 +911,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-lrzip-compressed-tar")) {
+ fr_process_begin_command (comm->process, "lrzip");
+ 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-lzip-compressed-tar")) {
fr_process_begin_command (comm->process, "lzip");
fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
@@ -949,6 +991,7 @@ const char *tar_mime_types[] = { "application/x-compressed-tar",
"application/x-bzip-compressed-tar",
"application/x-tar",
"application/x-7z-compressed-tar",
+ "application/x-lrzip-compressed-tar",
"application/x-lzip-compressed-tar",
"application/x-lzma-compressed-tar",
"application/x-lzop-compressed-tar",
@@ -994,6 +1037,10 @@ fr_command_tar_get_capabilities (FrCommand *comm,
else if (is_program_available ("gzip", check_command))
capabilities |= FR_COMMAND_CAN_READ;
}
+ else if (is_mime_type (mime_type, "application/x-lrzip-compressed-tar")) {
+ if (is_program_available ("lrzip", check_command))
+ capabilities |= FR_COMMAND_CAN_READ_WRITE;
+ }
else if (is_mime_type (mime_type, "application/x-lzip-compressed-tar")) {
if (is_program_available ("lzip", check_command))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
@@ -1061,6 +1108,8 @@ fr_command_tar_get_packages (FrCommand *comm,
else if (is_mime_type (mime_type, "application/x-tarz"))
return PACKAGES ("tar,gzip,ncompress");
else if (is_mime_type (mime_type, "application/x-lzip-compressed-tar"))
+ return PACKAGES ("tar,lrzip");
+ else if (is_mime_type (mime_type, "application/x-lzip-compressed-tar"))
return PACKAGES ("tar,lzip");
else if (is_mime_type (mime_type, "application/x-lzma-compressed-tar"))
return PACKAGES ("tar,lzma");
diff --git a/src/main.c b/src/main.c
index c631992..73ce2fd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -102,6 +102,8 @@ FrMimeTypeDescription mime_type_desc[] = {
{ "application/x-gzip", ".gz", NULL, 0 },
{ "application/x-java-archive", ".jar", N_("Jar (.jar)"), 0 },
{ "application/x-lha", ".lzh", N_("Lha (.lzh)"), 0 },
+ { "application/x-lrzip", ".lrz", N_("Lrzip (.lrz)"), 0},
+ { "application/x-lrzip-compressed-tar", ".tar.lrz", N_("Tar compressed with lrzip (.tar.lrz)"), 0 },
{ "application/x-lzip", ".lz", NULL, 0 },
{ "application/x-lzip-compressed-tar", ".tar.lz", N_("Tar compressed with lzip (.tar.lz)"), 0 },
{ "application/x-lzma", ".lzma", NULL, 0 },
@@ -119,7 +121,6 @@ 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/x-lrzip", ".lrz", N_("Lrzip (.lrz)"), 0},
{ NULL, NULL, NULL, 0 }
};
@@ -143,6 +144,7 @@ FrExtensionType file_ext_type[] = {
{ ".iso", "application/x-cd-image" },
{ ".jar", "application/x-java-archive" },
{ ".lha", "application/x-lha" },
+ { ".lrz", "application/x-lrzip" },
{ ".lzh", "application/x-lha" },
{ ".lz", "application/x-lzip" },
{ ".lzma", "application/x-lzma" },
@@ -155,6 +157,7 @@ FrExtensionType file_ext_type[] = {
{ ".tar.bz", "application/x-bzip-compressed-tar" },
{ ".tar.bz2", "application/x-bzip-compressed-tar" },
{ ".tar.gz", "application/x-compressed-tar" },
+ { ".tar.lrz", "application/x-lrzip-compressed-tar" },
{ ".tar.lz", "application/x-lzip-compressed-tar" },
{ ".tar.lzma", "application/x-lzma-compressed-tar" },
{ ".tar.lzo", "application/x-lzop-compressed-tar" },
@@ -175,7 +178,6 @@ FrExtensionType file_ext_type[] = {
{ ".Z", "application/x-compress" },
{ ".zip", "application/zip" },
{ ".zoo", "application/x-zoo" },
- { ".lrz", "application/x-lrzip" },
{ NULL, NULL }
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]