[gimp/gimp-2-10] app: fix "Bad interpreter" error messaging.



commit 87a9feb6d958037c9545f0d011f0ee9ad45d64c2
Author: Jehan <jehan girinstud io>
Date:   Sun Aug 19 12:21:57 2018 +0200

    app: fix "Bad interpreter" error messaging.
    
    If I override the `program` variable, and it is not found in PATH
    environment, then it is NULL and the error message is unhelpful. Make
    the return value of g_find_program_in_path() into a separate variable
    instead, and only override `program` in the end, when we know it is
    non-NULL.

 app/plug-in/gimpinterpreterdb.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/app/plug-in/gimpinterpreterdb.c b/app/plug-in/gimpinterpreterdb.c
index 85000ee1a1..4d9b785ece 100644
--- a/app/plug-in/gimpinterpreterdb.c
+++ b/app/plug-in/gimpinterpreterdb.c
@@ -294,16 +294,19 @@ gimp_interpreter_db_add_program (GimpInterpreterDB  *db,
 
   if (! g_file_test (program, G_FILE_TEST_IS_EXECUTABLE))
     {
-      program = g_find_program_in_path (program);
-      if (! program || ! g_file_test (program, G_FILE_TEST_IS_EXECUTABLE))
+      gchar *prog;
+
+      prog = g_find_program_in_path (program);
+      if (! prog || ! g_file_test (prog, G_FILE_TEST_IS_EXECUTABLE))
         {
           g_message (_("Bad interpreter referenced in interpreter file %s: %s"),
                      gimp_file_get_utf8_name (file),
                      gimp_filename_to_utf8 (program));
-          if (program)
-            g_free (program);
+          if (prog)
+            g_free (prog);
           return;
         }
+      program = prog;
     }
   else
     program = g_strdup (program);


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