summaryrefslogtreecommitdiff
path: root/src/fr-command-7z.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fr-command-7z.c')
-rw-r--r--src/fr-command-7z.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c
index 4c5b03a..d1617ae 100644
--- a/src/fr-command-7z.c
+++ b/src/fr-command-7z.c
@@ -204,7 +204,15 @@ list__process_line (char *line,
static void
fr_command_7z_begin_command (FrCommand *comm)
{
- if (is_program_in_path ("7z"))
+ // Modern 7-Zip by the original author.
+ // Statically linked from a binary distribution, almost guaranteed to work.
+ if (is_program_in_path ("7zzs"))
+ fr_process_begin_command (comm->process, "7zzs");
+ // Dynamically linked from either binary or source distribution.
+ else if (is_program_in_path ("7zz"))
+ fr_process_begin_command (comm->process, "7zz");
+ // Legacy p7zip project.
+ else if (is_program_in_path ("7z"))
fr_process_begin_command (comm->process, "7z");
else if (is_program_in_path ("7za"))
fr_process_begin_command (comm->process, "7za");
@@ -333,8 +341,10 @@ fr_command_7z_add (FrCommand *comm,
if (spd_support) fr_process_add_arg (comm->process, "-spd");
fr_process_add_arg (comm->process, "-bd");
+ fr_process_add_arg (comm->process, "-bb1");
fr_process_add_arg (comm->process, "-y");
- fr_process_add_arg (comm->process, "-l");
+ if (recursive)
+ fr_process_add_arg (comm->process, "-l");
add_password_arg (comm, comm->password, FALSE);
if ((comm->password != NULL)
&& (*comm->password != 0)
@@ -482,6 +492,7 @@ fr_command_7z_extract (FrCommand *comm,
if (spd_support) fr_process_add_arg (comm->process, "-spd");
fr_process_add_arg (comm->process, "-bd");
+ fr_process_add_arg (comm->process, "-bb1");
fr_process_add_arg (comm->process, "-y");
add_password_arg (comm, comm->password, FALSE);
@@ -617,24 +628,28 @@ fr_command_7z_get_capabilities (FrCommand *comm,
FrCommandCaps capabilities;
capabilities = FR_COMMAND_CAN_ARCHIVE_MANY_FILES;
- if (! is_program_available ("7za", check_command) && ! is_program_available ("7zr", check_command) && ! is_program_available ("7z", check_command))
+ gboolean available_7zip = is_program_available ("7zz", check_command) || is_program_available ("7zzs", check_command);
+ if (! available_7zip\
+ && ! is_program_available ("7za", check_command) \
+ && ! is_program_available ("7zr", check_command) \
+ && ! is_program_available ("7z", check_command))
return capabilities;
if (is_mime_type (mime_type, "application/x-7z-compressed")) {
capabilities |= FR_COMMAND_CAN_READ_WRITE | FR_COMMAND_CAN_CREATE_VOLUMES;
- if (is_program_available ("7z", check_command))
+ if (is_program_available ("7z", check_command) || available_7zip)
capabilities |= FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER;
}
else if (is_mime_type (mime_type, "application/x-7z-compressed-tar")) {
capabilities |= FR_COMMAND_CAN_READ_WRITE;
- if (is_program_available ("7z", check_command))
+ if (is_program_available ("7z", check_command) || available_7zip)
capabilities |= FR_COMMAND_CAN_ENCRYPT | FR_COMMAND_CAN_ENCRYPT_HEADER;
}
- else if (is_program_available ("7z", check_command)) {
+ else if (is_program_available ("7z", check_command) || available_7zip) {
if (is_mime_type (mime_type, "application/x-rar")
|| is_mime_type (mime_type, "application/x-cbr"))
{
- if (! check_command || g_file_test ("/usr/lib/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/lib/p7zip/Codecs/Rar.so", G_FILE_TEST_EXISTS)
+ if (! check_command || available_7zip || g_file_test ("/usr/lib/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/lib/p7zip/Codecs/Rar.so", G_FILE_TEST_EXISTS)
|| g_file_test ("/usr/libexec/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS) || g_file_test ("/usr/libexec/p7zip/Codecs/Rar.so", G_FILE_TEST_EXISTS))
capabilities |= FR_COMMAND_CAN_READ;
}
@@ -672,11 +687,11 @@ fr_command_7z_get_packages (FrCommand *comm,
const char *mime_type)
{
if (is_mime_type (mime_type, "application/x-rar"))
- return PACKAGES ("p7zip,p7zip-rar");
+ return PACKAGES ("7zip,7zip-rar");
else if (is_mime_type (mime_type, "application/zip") || is_mime_type (mime_type, "application/vnd.ms-cab-compressed"))
- return PACKAGES ("p7zip,p7zip-full");
+ return PACKAGES ("7zip,7zip-full");
else
- return PACKAGES ("p7zip");
+ return PACKAGES ("7zip");
}
static void