summaryrefslogtreecommitdiff
path: root/girepository
diff options
context:
space:
mode:
authorJohan Bilien <jobi@via.ecp.fr>2008-10-23 09:10:04 +0000
committerJohan Bilien <jobi@src.gnome.org>2008-10-23 09:10:04 +0000
commit7553fc1f909054a1606fb852e26d4631079ddec4 (patch)
treed6c8c209744ecc8352702274ab9970516c24b7c2 /girepository
parentcad66d84639e43de306c644c6daf6b7fcdd6c49f (diff)
downloadgobject-introspection-7553fc1f909054a1606fb852e26d4631079ddec4.tar.gz
Bug 557468 – Support for GI_TYPELIB_PATH
2008-10-23 Johan Bilien <jobi@via.ecp.fr> Bug 557468 – Support for GI_TYPELIB_PATH * girepository/girepository.c: if the GI_TYPELIB_PATH is set, add the provided paths to the global search path. svn path=/trunk/; revision=786
Diffstat (limited to 'girepository')
-rw-r--r--girepository/girepository.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/girepository/girepository.c b/girepository/girepository.c
index b43a451b..3e909532 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -84,8 +84,8 @@ init_globals ()
{
g_static_mutex_lock (&globals_lock);
- if (default_repository == NULL)
- {
+ if (default_repository == NULL)
+ {
default_repository = g_object_new (G_TYPE_IREPOSITORY, NULL);
}
@@ -93,14 +93,37 @@ init_globals ()
{
const gchar *const *datadirs;
const gchar *const *dir;
-
- datadirs = g_get_system_data_dirs ();
-
+ const gchar *type_lib_path_env;
+
+ type_lib_path_env = g_getenv ("GI_TYPELIB_PATH");
+
search_path = NULL;
- for (dir = datadirs; *dir; dir++) {
- char *path = g_build_filename (*dir, "girepository", NULL);
- search_path = g_slist_prepend (search_path, path);
- }
+ if (type_lib_path_env)
+ {
+ gchar **custom_dirs;
+ gchar **d;
+
+ custom_dirs = g_strsplit (type_lib_path_env, G_SEARCHPATH_SEPARATOR_S, 0);
+
+ d = custom_dirs;
+ while (*d)
+ {
+ search_path = g_slist_prepend (search_path, *d);
+ d++;
+ }
+
+ /* ownership of the array content was passed to the list */
+ g_free (custom_dirs);
+ }
+
+ datadirs = g_get_system_data_dirs ();
+
+ for (dir = datadirs; *dir; dir++)
+ {
+ char *path = g_build_filename (*dir, "girepository", NULL);
+ search_path = g_slist_prepend (search_path, path);
+ }
+
search_path = g_slist_reverse (search_path);
}