[recipes] Don't use XDG_DATA_DIRS for locating data



commit 381941e7adf5ec68d2b7d276ac46a47538e3f095
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Mar 2 23:10:46 2017 -0500

    Don't use XDG_DATA_DIRS for locating data
    
    This doesn't quite work on a flatpak-enabled system
    where the first item in XDG_DATA_DIRS will point to
    the export location for system-wide flatpaks.
    
    Instead, add a decicated environment variable to
    override PKGDATADIR on OS X.

 osx/gnome-recipes.sh |    1 +
 src/gr-utils.c       |    8 ++------
 2 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/osx/gnome-recipes.sh b/osx/gnome-recipes.sh
index 8e8ad8e..5527922 100644
--- a/osx/gnome-recipes.sh
+++ b/osx/gnome-recipes.sh
@@ -18,6 +18,7 @@ export XDG_DATA_DIRS="$bundle_data"
 export GTK_DATA_PREFIX="$bundle_res"
 export GTK_EXE_PREFIX="$bundle_res"
 export GTK_PATH="$bundle_res"
+export PKG_DATA_DIR="$bundle_res"/share/gnome-recipes
 
 # PANGO_* is no longer needed for pango >= 1.38
 export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
diff --git a/src/gr-utils.c b/src/gr-utils.c
index 56a7e6b..62d0d41 100644
--- a/src/gr-utils.c
+++ b/src/gr-utils.c
@@ -149,12 +149,8 @@ get_pkg_data_dir (void)
         static char *dir = NULL;
 
         if (!dir) {
-                const char * const *dirs;
-
-                dirs = g_get_system_data_dirs ();
-
-                if (dirs)
-                        dir = g_build_filename (dirs[0], PACKAGE_NAME, NULL);
+                if (g_getenv ("PKG_DATA_DIR"))
+                        dir = (char *)g_getenv ("PKG_DATA_DIR");
                 else
                         dir = (char *)PKGDATADIR;
         }


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