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




commit 54ee677cd5eaba21909fa52e6eb58ef7db975984
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 d1ec1527..cd795664 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]