[gimp/wip/Jehan/fixing-release-gimp-2-99-10-win: 4/4] app: don't use build-time path for the desktop datadir.




commit 895a0038ceac0feb875a756b6a26eb123a6339f0
Author: Jehan <jehan girinstud io>
Date:   Fri Feb 25 14:05:36 2022 +0100

    app: don't use build-time path for the desktop datadir.
    
    Build time directory won't work on Windows (and most likely neither on
    macOS with their relocatable packages).

 app/dialogs/welcome-dialog.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/app/dialogs/welcome-dialog.c b/app/dialogs/welcome-dialog.c
index f0c85e8aef..004b9f6749 100644
--- a/app/dialogs/welcome-dialog.c
+++ b/app/dialogs/welcome-dialog.c
@@ -89,7 +89,13 @@ welcome_dialog_create (Gimp *gimp)
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
-  appdata_path = g_build_filename (DESKTOP_DATADIR, "metainfo",
+  /* Why I am using gimp_data_directory() then backing out 2 directories
+   * instead of directly using gimp_installation_directory () is because
+   * the 'datadir' might be customized, so I don't want to hardcode
+   * "share". It might be something else.
+   */
+  appdata_path = g_build_filename (gimp_data_directory (),
+                                   "..", "..", "metainfo",
                                    "org.gimp.GIMP.appdata.xml",
                                    NULL);
   if (! g_file_test (appdata_path, G_FILE_TEST_IS_REGULAR))
@@ -104,7 +110,8 @@ welcome_dialog_create (Gimp *gimp)
       g_printerr ("%s: AppStream file '%s' is not a regular file.\n",
                   G_STRFUNC, appdata_path);
       g_free (appdata_path);
-      appdata_path = g_build_filename (DESKTOP_DATADIR, "appdata",
+      appdata_path = g_build_filename (gimp_data_directory (),
+                                       "..", "..", "appdata",
                                        "org.gimp.GIMP.appdata.xml",
                                        NULL);
     }


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