[file-roller/wip/jtojnar/7zip: 3/3] wip: Try to debug rar support




commit d6016a0ced5e2485ca0231c127a7c9a295620d54
Author: Jan Tojnar <jtojnar gmail com>
Date:   Tue Jun 21 11:36:16 2022 +0200

    wip: Try to debug rar support

 src/fr-command-7z.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c
index f3ecd6e4..836e32ca 100644
--- a/src/fr-command-7z.c
+++ b/src/fr-command-7z.c
@@ -600,38 +600,49 @@ fr_command_7z_get_mime_types (FrArchive *archive)
 static gboolean
 check_info_subcommand_for_codec_support (char *program_name, char *codec_name) {
        if (! _g_program_is_in_path (program_name)) {
+               debug(DEBUG_INFO, "rar1: %d\n", FALSE);
                return FALSE;
        }
 
        g_autofree gchar **standard_output = NULL;
+       g_autofree gchar **standard_error = NULL;
 
        gchar* argv[] = {
                program_name,
                "i"
        };
+       g_autoptr (GError) error = NULL;
        if (!g_spawn_sync (
                /* working_directory = */ NULL,
                argv,
                /* envp = */ NULL,
-               G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
+               G_SPAWN_SEARCH_PATH/* | G_SPAWN_STDERR_TO_DEV_NULL*/,
                /* child_setup = */ NULL,
                /* user_data = */ NULL,
                standard_output,
-               /* standard_error = */ NULL,
+               standard_error,
+               // /* standard_error = */ NULL,
                /* wait_status = */ NULL,
-               /* error = */ NULL
+               // /* error = */ NULL
+               &error
        )) {
+               g_warning("stdout %s\n", standard_output ? *standard_output : "???");
+               g_warning("stderr %s\n", standard_error ? *standard_error : "???");
+               g_warning("error %s\n", error->message);
+               debug(DEBUG_INFO, "rar2: %d\n", FALSE);
                return FALSE;
        }
 
        gchar *codecs = g_strrstr(*standard_output, "Codecs:");
 
        if (codecs == NULL) {
+               debug(DEBUG_INFO, "rar3: %d\n", FALSE);
                return FALSE;
        }
 
        gchar *codec_found = g_strrstr(codecs, codec_name);
 
+       debug(DEBUG_INFO, "rar4: %d\n", codec_found != NULL);
        return codec_found != NULL;
 }
 


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