diff options
author | Alexander Larsson <alexl@redhat.com> | 2016-05-17 11:55:41 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2016-05-17 11:55:41 +0200 |
commit | 18992c2fa0dfdcc93b516f3cb3a22f19d9af4c43 (patch) | |
tree | 9e6466f39fa01cf95b280b691077fbecb883d2c7 | |
parent | 251dcdb680a623627fafa47e85c602814835c3d3 (diff) | |
download | xdg-app-18992c2fa0dfdcc93b516f3cb3a22f19d9af4c43.tar.gz |
Look at FLATPAK_SYSTEM_DIR env var for default system dir
This is useful for testing
-rw-r--r-- | common/flatpak-dir.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 017f4b7..736a5ec 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -178,7 +178,20 @@ flatpak_deploy_new (GFile *dir, GKeyFile *metadata) GFile * flatpak_get_system_base_dir_location (void) { - return g_file_new_for_path (FLATPAK_SYSTEMDIR); + static gsize path = 0; + + if (g_once_init_enter (&path)) + { + gsize setup_value = 0; + const char *system_dir = g_getenv ("FLATPAK_SYSTEM_DIR"); + if (system_dir != NULL) + setup_value = (gsize)system_dir; + else + setup_value = (gsize)FLATPAK_SYSTEMDIR; + g_once_init_leave (&path, setup_value); + } + + return g_file_new_for_path ((char *)path); } GFile * |