[gimp/wip/Jehan/layers-dockable-refresh: 75/87] app: find templaterc and controllerrc when testing the build.




commit 0cf77c9640c55bcc15b3375a3ef8b1ffe6211f6f
Author: Jehan <jehan girinstud io>
Date:   Sat Oct 23 01:57:30 2021 +0200

    app: find templaterc and controllerrc when testing the build.
    
    This should fix these errors when running `ninja test` or `make check`:
    
    > GIMP-Error: Failed to open file ?/builds/GNOME/gimp/_install/etc/gimp/2.99/templaterc?: open() failed: 
No such file or directory
    > GIMP-Error: Failed to open file ?/builds/GNOME/gimp/_install/etc/gimp/2.99/controllerrc?: open() 
failed: No such file or directory

 app/core/gimp-templates.c     | 13 ++++++++++++-
 app/widgets/gimpcontrollers.c | 13 ++++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimp-templates.c b/app/core/gimp-templates.c
index 3d0142a1bc..3a25c86541 100644
--- a/app/core/gimp-templates.c
+++ b/app/core/gimp-templates.c
@@ -57,7 +57,18 @@ gimp_templates_load (Gimp *gimp)
           g_clear_error (&error);
           g_object_unref (file);
 
-          file = gimp_sysconf_directory_file ("templaterc", NULL);
+          if (g_getenv ("GIMP_TESTING_ABS_TOP_SRCDIR"))
+            {
+              gchar *path;
+              path = g_build_filename (g_getenv ("GIMP_TESTING_ABS_TOP_SRCDIR"),
+                                       "etc", "templaterc", NULL);
+              file = g_file_new_for_path (path);
+              g_free (path);
+            }
+          else
+            {
+              file = gimp_sysconf_directory_file ("templaterc", NULL);
+            }
 
           if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->templates),
                                               file, NULL, &error))
diff --git a/app/widgets/gimpcontrollers.c b/app/widgets/gimpcontrollers.c
index 9268627121..d7ff9ac7e1 100644
--- a/app/widgets/gimpcontrollers.c
+++ b/app/widgets/gimpcontrollers.c
@@ -158,7 +158,18 @@ gimp_controllers_restore (Gimp          *gimp,
           g_clear_error (&error);
           g_object_unref (file);
 
-          file = gimp_sysconf_directory_file ("controllerrc", NULL);
+          if (g_getenv ("GIMP_TESTING_ABS_TOP_SRCDIR"))
+            {
+              gchar *path;
+              path = g_build_filename (g_getenv ("GIMP_TESTING_ABS_TOP_SRCDIR"),
+                                       "etc", "controllerrc", NULL);
+              file = g_file_new_for_path (path);
+              g_free (path);
+            }
+          else
+            {
+              file = gimp_sysconf_directory_file ("controllerrc", NULL);
+            }
 
           if (! gimp_config_deserialize_file (GIMP_CONFIG (manager->controllers),
                                               file, NULL, &error))


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