From 72f8e634414d1a29db6bb9d774c6f726812e186a Mon Sep 17 00:00:00 2001 From: Jehan Date: Sat, 23 Oct 2021 01:57:30 +0200 Subject: [PATCH] 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))