[file-roller/wip/jtojnar/7zip: 19/20] command-7z: Fix detection of unrar potential support
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/jtojnar/7zip: 19/20] command-7z: Fix detection of unrar potential support
- Date: Thu, 14 Jul 2022 17:37:27 +0000 (UTC)
commit d654eb88f6e9bcb672c2449b41ae21c479d2d94f
Author: Jan Tojnar <jtojnar gmail com>
Date: Thu Jul 14 18:37:32 2022 +0200
command-7z: Fix detection of unrar potential support
The potential capabilities introduced in
https://gitlab.gnome.org/GNOME/file-roller/-/commit/e7fe13ab35956fe1c68c4e3fa35b9e3e2f155568
which can be gained by installing extra software should clearly be
a superset of the current capabilities.
But this is not the case when a `FrArchive` subclass checks
for the availability of a program to “give way” to another
`FrArchive` subclass that supports more features for given format.
This is caused by the fact that when scanning for a potential
capabilities, the `check_command` argument is `TRUE` and `_g_program_is_available`
function will pretend that the program is available.
This will cause the `FrArchive` instance deny its potential capabilities
because it will yield to a different one.
https://gitlab.gnome.org/GNOME/file-roller/-/commit/160fd2dab3977fa9fdf727cb74e6a23b8fc9d20b
src/fr-archive-libarchive.c | 20 ++++++++++----------
src/fr-command-7z.c | 4 ++--
2 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/fr-archive-libarchive.c b/src/fr-archive-libarchive.c
index bc601c07..5a8376e0 100644
--- a/src/fr-archive-libarchive.c
+++ b/src/fr-archive-libarchive.c
@@ -116,9 +116,9 @@ fr_archive_libarchive_get_capabilities (FrArchive *archive,
/* give priority to 7z* for 7z archives. */
if (strcmp (mime_type, "application/x-7z-compressed") == 0) {
- if (_g_program_is_available ("7za", check_command)
- || _g_program_is_available ("7zr", check_command)
- || _g_program_is_available ("7z", check_command))
+ if (_g_program_is_available ("7za", TRUE)
+ || _g_program_is_available ("7zr", TRUE)
+ || _g_program_is_available ("7z", TRUE))
{
return capabilities;
}
@@ -126,7 +126,7 @@ fr_archive_libarchive_get_capabilities (FrArchive *archive,
/* give priority to 7za that supports CAB files better. */
if ((strcmp (mime_type, "application/vnd.ms-cab-compressed") == 0)
- && _g_program_is_available ("7za", check_command))
+ && _g_program_is_available ("7za", TRUE))
{
return capabilities;
}
@@ -135,13 +135,13 @@ fr_archive_libarchive_get_capabilities (FrArchive *archive,
if ((strcmp (mime_type, "application/zip") == 0)
|| (strcmp (mime_type, "application/x-cbz") == 0))
{
- if (_g_program_is_available ("7z", check_command)) {
+ if (_g_program_is_available ("7z", TRUE)) {
return capabilities;
}
- if (!_g_program_is_available ("unzip", check_command)) {
+ if (!_g_program_is_available ("unzip", TRUE)) {
capabilities |= FR_ARCHIVE_CAN_READ;
}
- if (!_g_program_is_available ("zip", check_command)) {
+ if (!_g_program_is_available ("zip", TRUE)) {
capabilities |= FR_ARCHIVE_CAN_WRITE;
}
return capabilities;
@@ -151,9 +151,9 @@ fr_archive_libarchive_get_capabilities (FrArchive *archive,
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)
- || _g_program_is_available ("unar", check_command)) {
+ if (_g_program_is_available ("rar", TRUE)
+ || _g_program_is_available ("unrar", TRUE)
+ || _g_program_is_available ("unar", TRUE)) {
return capabilities;
}
}
diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c
index 4e48a400..fe4573b6 100644
--- a/src/fr-command-7z.c
+++ b/src/fr-command-7z.c
@@ -615,8 +615,8 @@ fr_command_7z_get_capabilities (FrArchive *archive,
|| _g_mime_type_matches (mime_type, "application/x-cbr"))
{
/* 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)
+ if (!_g_program_is_available ("rar", TRUE)
+ && !_g_program_is_available ("unrar", TRUE)
&& (! check_command || g_file_test ("/usr/lib/p7zip/Codecs/Rar.so",
G_FILE_TEST_EXISTS)))
capabilities |= FR_ARCHIVE_CAN_READ;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]