[file-roller] added support for lzip compression
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Subject: [file-roller] added support for lzip compression
- Date: Mon, 15 Jun 2009 13:21:47 -0400 (EDT)
commit 6f4ee6a4727d47c20e5923888f2f446850146b5d
Author: Antonio Diaz <ant_diaz teleline es>
Date: Mon Jun 15 19:20:39 2009 +0200
added support for lzip compression
GNOME Bug #579467
README | 7 ++++-
data/file-roller.desktop.in.in | 2 +-
file-roller.spec.in | 34 ++++++++++++++++++++++++-----
help/C/file-roller.xml | 6 ++++-
nautilus/nautilus-fileroller.c | 2 +
src/fr-archive.c | 1 +
src/fr-command-cfile.c | 20 +++++++++++++++++
src/fr-command-tar.c | 46 ++++++++++++++++++++++++++++++++++++++++
src/main.c | 5 ++++
9 files changed, 113 insertions(+), 10 deletions(-)
---
diff --git a/README b/README
index 94c2840..5c0802f 100644
--- a/README
+++ b/README
@@ -31,18 +31,21 @@
* RPM Linux Package (.rpm) [Read-only mode]
* Tape Archive File:
* uncompressed (.tar)
- or compressed with
+ or compressed with:
* gzip (.tar.gz , .tgz)
* bzip (.tar.bz , .tbz)
* bzip2 (.tar.bz2 , .tbz2)
* compress (.tar.Z , .taz)
+ * lzip (.tar.lz , .tlz)
* lzop (.tar.lzo , .tzo)
* 7zip (.tar.7z)
+ * xz (.tar.xz)
* Stuffit Archives (.bin, .sit)
* ZIP Archive (.zip)
* ZIP Archived Comic Book (.cbz)
* ZOO Compressed Archive File (.zoo)
- * Single files compressed with gzip, bzip, bzip2, compress, lzop, rzip.
+ * Single files compressed with gzip, bzip, bzip2, compress, lzip, lzop,
+ rzip, xz.
* Home Page
diff --git a/data/file-roller.desktop.in.in b/data/file-roller.desktop.in.in
index 0df2cc8..c6c075d 100644
--- a/data/file-roller.desktop.in.in
+++ b/data/file-roller.desktop.in.in
@@ -9,7 +9,7 @@ Terminal=false
Type=Application
Icon=file-roller
Categories=GTK;GNOME;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-lzma;application/x-lzma-compressed-tar;application/x-lzop;application/x-lzop-compressed-tar;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;multipart/x-zip;
+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-lzip;application/x-lzip-compressed-tar;application/x-lzma;application/x-lzma-compressed-tar;application/x-lzop;application/x-lzop-compressed-tar;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;applic
ation/x-zip-compressed;application/x-zoo;application/zip;multipart/x-zip;
X-GNOME-DocPath=file-roller/file-roller.xml
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=file-roller
diff --git a/file-roller.spec.in b/file-roller.spec.in
index 0221474..866d737 100644
--- a/file-roller.spec.in
+++ b/file-roller.spec.in
@@ -40,17 +40,39 @@ you can : create and modify archives; view the content of an archive; view a
file contained in the archive; extract files from the archive.
File Roller is only a front-end (a graphical interface) to archiving programs
like tar and zip. The supported file types are :
- * Tar archives uncompressed (.tar) or compressed with
+ * 7-Zip Compressed File (.7z)
+ * WinAce Compressed File (.ace)
+ * ALZip Compressed File (.alz)
+ * AIX Small Indexed Archive (.ar)
+ * ARJ Compressed Archive (.arj)
+ * Cabinet File (.cab)
+ * UNIX CPIO Archive (.cpio)
+ * Debian Linux Package (.deb) [Read-only mode]
+ * ISO-9660 CD Disc Image (.iso) [Read-only mode]
+ * Java Archive (.jar)
+ * Java Enterprise archive (.ear)
+ * Java Web Archive (.war)
+ * LHA Archive (.lzh, .lha)
+ * WinRAR Compressed Archive (.rar)
+ * RAR Archived Comic Book (.cbr)
+ * RPM Linux Package (.rpm) [Read-only mode]
+ * Tape Archive File:
+ * uncompressed (.tar)
+ or compressed with:
* gzip (.tar.gz , .tgz)
* bzip (.tar.bz , .tbz)
* bzip2 (.tar.bz2 , .tbz2)
* compress (.tar.Z , .taz)
+ * lzip (.tar.lz , .tlz)
* lzop (.tar.lzo , .tzo)
- * Zip archives (.zip)
- * Jar archives (.jar , .ear , .war)
- * Lha archives (.lzh)
- * Rar archives (.rar)
- * Single files compressed with gzip, bzip, bzip2, compress, lzop
+ * 7zip (.tar.7z)
+ * xz (.tar.xz)
+ * Stuffit Archives (.bin, .sit)
+ * ZIP Archive (.zip)
+ * ZIP Archived Comic Book (.cbz)
+ * ZOO Compressed Archive File (.zoo)
+ * Single files compressed with gzip, bzip, bzip2, compress, lzip, lzop,
+ rzip, xz.
%prep
%setup
diff --git a/help/C/file-roller.xml b/help/C/file-roller.xml
index 4f3ee2a..73aaa11 100644
--- a/help/C/file-roller.xml
+++ b/help/C/file-roller.xml
@@ -339,6 +339,10 @@
<entry align="left"><para><filename>.tar.gz</filename> or <filename>.tgz</filename></para></entry>
</row>
<row valign="top">
+ <entry><para>Tar archive compressed with <command>lzip</command></para></entry>
+ <entry align="left"><para><filename>.tar.lz</filename> or <filename>.tlz</filename></para></entry>
+ </row>
+ <row valign="top">
<entry><para>Tar archive compressed with <command>lzop</command></para></entry>
<entry align="left"><para><filename>.tar.lzo</filename> or <filename>.tzo</filename></para></entry>
</row>
@@ -373,7 +377,7 @@
<para>The most common archive format on Microsoft Windows systems is the archive created with <application>PKZIP</application> or <application>WinZip</application>. </para>
<sect2 id="file-roller-intro-nonarchive">
<title>Compressed Non-Archive Files</title>
- <para>A compressed non-archive file is a file that is created when you use <command>bzip2</command>, <command>gzip</command>, <command>lzop</command>, <command>compress</command> or <command>rzip</command> to compress a non-archive file. For example, <filename>file.txt.gz</filename> is created when you use <command>gzip</command> to compress <filename>file.txt</filename>.</para>
+ <para>A compressed non-archive file is a file that is created when you use <command>bzip2</command>, <command>gzip</command>, <command>lzip</command>, <command>lzop</command>, <command>compress</command> or <command>rzip</command> to compress a non-archive file. For example, <filename>file.txt.gz</filename> is created when you use <command>gzip</command> to compress <filename>file.txt</filename>.</para>
<para>You can use &app; to create, open and extract a compressed non-archive file.</para>
</sect2>
</sect1>
diff --git a/nautilus/nautilus-fileroller.c b/nautilus/nautilus-fileroller.c
index 409331d..60c7bdd 100644
--- a/nautilus/nautilus-fileroller.c
+++ b/nautilus/nautilus-fileroller.c
@@ -167,6 +167,8 @@ static char *mime_types[] = {
"application/x-java-archive",
"application/x-lha",
"application/x-lhz",
+ "application/x-lzip",
+ "application/x-lzip-compressed-tar",
"application/x-lzma",
"application/x-lzma-compressed-tar",
"application/x-lzop",
diff --git a/src/fr-archive.c b/src/fr-archive.c
index a96445f..27a8cd9 100644
--- a/src/fr-archive.c
+++ b/src/fr-archive.c
@@ -537,6 +537,7 @@ get_mime_type_from_magic_numbers (GFile *file)
{ "application/x-ace", "**ACE**", 7, 7 },
{ "application/x-arj", "\x60\xea", 0, 2 },
{ "application/x-gzip", "\037\213", 0, 2 },
+ { "application/x-lzip", "LZIP", 0, 4 },
{ "application/x-rar", "Rar!", 0, 4 },
{ "application/x-rzip", "RZIP", 0, 4 },
{ "application/x-zoo", "\xdc\xa7\xc4\xfd", 20, 4 },
diff --git a/src/fr-command-cfile.c b/src/fr-command-cfile.c
index 9f2953b..6b2d05c 100644
--- a/src/fr-command-cfile.c
+++ b/src/fr-command-cfile.c
@@ -249,6 +249,14 @@ fr_command_cfile_add (FrCommand *comm,
fr_process_end_command (comm->process);
compressed_filename = g_strconcat (filename, ".Z", NULL);
}
+ else if (is_mime_type (comm->mime_type, "application/x-lzip")) {
+ fr_process_begin_command (comm->process, "lzip");
+ 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, ".lz", NULL);
+ }
else if (is_mime_type (comm->mime_type, "application/x-lzma")) {
fr_process_begin_command (comm->process, "lzma");
fr_process_set_working_dir (comm->process, temp_dir);
@@ -375,6 +383,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-lzip")) {
+ fr_process_begin_command (comm->process, "lzip");
+ 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-lzma")) {
fr_process_begin_command (comm->process, "lzma");
fr_process_add_arg (comm->process, "-f");
@@ -443,6 +458,7 @@ fr_command_cfile_extract (FrCommand *comm,
const char *cfile_mime_type[] = { "application/x-gzip",
"application/x-bzip",
"application/x-compress",
+ "application/x-lzip",
"application/x-lzma",
"application/x-lzop",
"application/x-rzip",
@@ -478,6 +494,10 @@ fr_command_cfile_get_capabilities (FrCommand *comm,
if (is_program_in_path ("uncompress") || is_program_in_path ("gzip"))
capabilities |= FR_COMMAND_CAN_READ;
}
+ else if (is_mime_type (mime_type, "application/x-lzip")) {
+ if (is_program_in_path ("lzip"))
+ capabilities |= FR_COMMAND_CAN_READ_WRITE;
+ }
else if (is_mime_type (mime_type, "application/x-lzma")) {
if (is_program_in_path ("lzma"))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c
index e7ffc23..4ce8f66 100644
--- a/src/fr-command-tar.c
+++ b/src/fr-command-tar.c
@@ -203,6 +203,9 @@ add_compress_arg (FrCommand *comm)
else
fr_process_add_arg (comm->process, "-Z");
}
+ else if (is_mime_type (comm->mime_type, "application/x-lzip-compressed-tar"))
+ fr_process_add_arg (comm->process, "--use-compress-program=lzip");
+
else if (is_mime_type (comm->mime_type, "application/x-lzma-compressed-tar"))
fr_process_add_arg (comm->process, "--use-compress-program=lzma");
@@ -534,6 +537,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-lzip-compressed-tar")) {
+ fr_process_begin_command (comm->process, "lzip");
+ 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, "-1"); break;
+ case FR_COMPRESSION_FAST:
+ fr_process_add_arg (comm->process, "-3"); break;
+ case FR_COMPRESSION_NORMAL:
+ fr_process_add_arg (comm->process, "-6"); break;
+ case FR_COMPRESSION_MAXIMUM:
+ fr_process_add_arg (comm->process, "-9"); break;
+ }
+ fr_process_add_arg (comm->process, "-f");
+ fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+ fr_process_end_command (comm->process);
+
+ new_name = g_strconcat (c_tar->uncomp_filename, ".lz", NULL);
+ }
else if (is_mime_type (comm->mime_type, "application/x-lzma-compressed-tar")) {
fr_process_begin_command (comm->process, "lzma");
fr_process_set_sticky (comm->process, TRUE);
@@ -705,6 +728,16 @@ 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-lzip-compressed-tar")) {
+ /* X.tlz --> X.tar
+ * X.tar.lz --> X.tar */
+ if (file_extension_is (e_filename, ".tlz")) {
+ new_name[l - 2] = 'a';
+ new_name[l - 1] = 'r';
+ }
+ else if (file_extension_is (e_filename, ".tar.lz"))
+ new_name[l - 3] = 0;
+ }
else if (is_mime_type (comm->mime_type, "application/x-lzma-compressed-tar")) {
/* X.tar.lzma --> X.tar
* (There doesn't seem to be a shorthand suffix) */
@@ -820,6 +853,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-lzip-compressed-tar")) {
+ fr_process_begin_command (comm->process, "lzip");
+ 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-lzma-compressed-tar")) {
fr_process_begin_command (comm->process, "lzma");
fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
@@ -884,6 +925,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-lzip-compressed-tar",
"application/x-lzma-compressed-tar",
"application/x-lzop-compressed-tar",
"application/x-tarz",
@@ -927,6 +969,10 @@ fr_command_tar_get_capabilities (FrCommand *comm,
else if (is_program_in_path ("gzip"))
capabilities |= FR_COMMAND_CAN_READ;
}
+ else if (is_mime_type (mime_type, "application/x-lzip-compressed-tar")) {
+ if (is_program_in_path ("lzip"))
+ capabilities |= FR_COMMAND_CAN_READ_WRITE;
+ }
else if (is_mime_type (mime_type, "application/x-lzma-compressed-tar")) {
if (is_program_in_path ("lzma"))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
diff --git a/src/main.c b/src/main.c
index 90b9f72..0981a23 100644
--- a/src/main.c
+++ b/src/main.c
@@ -101,6 +101,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-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 },
{ "application/x-lzma-compressed-tar", ".tar.lzma", N_("Tar compressed with lzma (.tar.lzma)"), 0 },
{ "application/x-lzop", ".lzo", NULL, 0 },
@@ -140,6 +142,7 @@ FrExtensionType file_ext_type[] = {
{ ".jar", "application/x-java-archive" },
{ ".lha", "application/x-lha" },
{ ".lzh", "application/x-lha" },
+ { ".lz", "application/x-lzip" },
{ ".lzma", "application/x-lzma" },
{ ".lzo", "application/x-lzop" },
{ ".rar", "application/x-rar" },
@@ -150,6 +153,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.lz", "application/x-lzip-compressed-tar" },
{ ".tar.lzma", "application/x-lzma-compressed-tar" },
{ ".tar.lzo", "application/x-lzop-compressed-tar" },
{ ".tar.7z", "application/x-7z-compressed-tar" },
@@ -160,6 +164,7 @@ FrExtensionType file_ext_type[] = {
{ ".tbz2", "application/x-bzip-compressed-tar" },
{ ".tgz", "application/x-compressed-tar" },
{ ".txz", "application/x-xz-compressed-tar" },
+ { ".tlz", "application/x-lzip-compressed-tar" },
{ ".tzma", "application/x-lzma-compressed-tar" },
{ ".tzo", "application/x-lzop-compressed-tar" },
{ ".war", "application/x-war" },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]