[recipes] Stop hardcoding PKGDATADIR
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Stop hardcoding PKGDATADIR
- Date: Tue, 28 Feb 2017 12:35:09 +0000 (UTC)
commit c964e8d4464628b2eef1ae218b4ab93ede961d0e
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Feb 28 07:15:39 2017 -0500
Stop hardcoding PKGDATADIR
This gets in the way on OS X where we need everything
to be relocatable for building an app bundle.
Instead of PKGDATADIR, use XDG_DATA_DIRS[0]/gnome-recipes.
src/gr-utils.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-utils.c b/src/gr-utils.c
index 07383fa..aea8a71 100644
--- a/src/gr-utils.c
+++ b/src/gr-utils.c
@@ -146,7 +146,20 @@ get_old_user_data_dir (void)
const char *
get_pkg_data_dir (void)
{
- return PKGDATADIR;
+ 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);
+ else
+ dir = (char *)PKGDATADIR;
+ }
+
+ return (const char *)dir;
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]