[file-roller] Give priority to rar and unrar that supports RAR files better



commit 160fd2dab3977fa9fdf727cb74e6a23b8fc9d20b
Author: Balló György <ballogyor gmail com>
Date:   Thu Apr 16 10:34:57 2015 +0200

    Give priority to rar and unrar that supports RAR files better
    
    rar and unrar supports the RAR5 archive format, while libarchive and p7zip not.

 src/fr-archive-libarchive.c |   10 ++++++++++
 src/fr-command-7z.c         |    5 ++++-
 2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/fr-archive-libarchive.c b/src/fr-archive-libarchive.c
index 9674098..2b70528 100644
--- a/src/fr-archive-libarchive.c
+++ b/src/fr-archive-libarchive.c
@@ -137,6 +137,16 @@ fr_archive_libarchive_get_capabilities (FrArchive  *archive,
                return capabilities;
        }
 
+       /* give priority to rar and unrar that supports RAR files better. */
+       if ((strcmp (mime_type, "application/x-rar") == 0)
+           || (strcmp (mime_type, "application/x-cbr") == 0))
+       {
+               if (_g_program_is_available ("rar", check_command)
+                   || _g_program_is_available ("unrar", check_command)) {
+                       return capabilities;
+               }
+       }
+
        /* tar.lrz format requires external lrzip */
        if (strcmp (mime_type, "application/x-lrzip-compressed-tar") == 0) {
                if (!_g_program_is_available ("lrzip", check_command))
diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c
index e6e8258..62a8fbe 100644
--- a/src/fr-command-7z.c
+++ b/src/fr-command-7z.c
@@ -616,7 +616,10 @@ fr_command_7z_get_capabilities (FrArchive  *archive,
                if (_g_mime_type_matches (mime_type, "application/x-rar")
                    || _g_mime_type_matches (mime_type, "application/x-cbr"))
                {
-                       if (! check_command || g_file_test ("/usr/lib/p7zip/Codecs/Rar29.so", 
G_FILE_TEST_EXISTS))
+                       /* give priority to rar and unrar that supports RAR files better. */
+                       if (!_g_program_is_available ("rar", check_command)
+                           && !_g_program_is_available ("unrar", check_command)
+                           && g_file_test ("/usr/lib/p7zip/Codecs/Rar29.so", G_FILE_TEST_EXISTS))
                                capabilities |= FR_ARCHIVE_CAN_READ;
                }
                else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]