summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2016-04-28 16:22:38 +0200
committerCarlos Garnacho <carlosg@gnome.org>2016-05-02 16:20:31 +0200
commitbd475c00d96235d8f4a0a02006de378d10f5f9b3 (patch)
tree9e7b794583e88821f767652aa37b0dbfd712c417
parent43597c9137db771bb372571698183b2ed1d6c9de (diff)
downloadgobject-introspection-bd475c00d96235d8f4a0a02006de378d10f5f9b3.tar.gz
girepository: Merge overrides with the regular search path
This reverts commit e81c4681cc88a00fcd841c5a68d860d3714b55d7 The GI_TYPELIB_PATH envvar will still allow overriding the default typelib dir (based on gobject-introspection libdir), but applications will have the last say about typelib lookup directories. The resulting lookup order is now: - Paths added through g_irepository_prepend_search_path() - Paths in GI_TYPELIB_PATH - The default gobject introspection lookup dir This makes g_irespository_prepend_search_path() work as announced despite environment variables. If any application was relying on GI_TYPELIB_PATH overriding the paths of this function call (for e.g. make check, or to be able to run code inside the project tree), it is encouraged to set up a similar envvar for their application specific lookup dir, or perform this override through other means. https://bugzilla.gnome.org/show_bug.cgi?id=765735
-rw-r--r--girepository/girepository.c32
1 files changed, 3 insertions, 29 deletions
diff --git a/girepository/girepository.c b/girepository/girepository.c
index 4537c03d..d9f8f6c3 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -46,7 +46,6 @@
static GIRepository *default_repository = NULL;
static GSList *search_path = NULL;
-static GSList *override_search_path = NULL;
struct _GIRepositoryPrivate
{
@@ -163,7 +162,6 @@ init_globals (void)
type_lib_path_env = g_getenv ("GI_TYPELIB_PATH");
search_path = NULL;
- override_search_path = NULL;
if (type_lib_path_env)
{
gchar **custom_dirs;
@@ -174,7 +172,7 @@ init_globals (void)
d = custom_dirs;
while (*d)
{
- override_search_path = g_slist_prepend (override_search_path, *d);
+ search_path = g_slist_prepend (search_path, *d);
d++;
}
@@ -182,9 +180,6 @@ init_globals (void)
g_free (custom_dirs);
}
- if (override_search_path != NULL)
- override_search_path = g_slist_reverse (override_search_path);
-
libdir = GOBJECT_INTROSPECTION_LIBDIR;
typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
@@ -227,23 +222,6 @@ g_irepository_get_search_path (void)
return search_path;
}
-static GSList *
-build_search_path_with_overrides (void)
-{
- GSList *result;
-
- init_globals ();
-
- if (override_search_path != NULL)
- {
- result = g_slist_copy (override_search_path);
- g_slist_last (result)->next = g_slist_copy (search_path);
- }
- else
- result = g_slist_copy (search_path);
- return result;
-}
-
static char *
build_typelib_key (const char *name, const char *source)
{
@@ -1394,13 +1372,11 @@ g_irepository_enumerate_versions (GIRepository *repository,
const gchar *namespace_)
{
GList *ret = NULL;
- GSList *search_path;
GSList *candidates, *link;
const gchar *loaded_version;
- search_path = build_search_path_with_overrides ();
+ init_globals ();
candidates = enumerate_namespace_versions (namespace_, search_path);
- g_slist_free (search_path);
for (link = candidates; link; link = link->next)
{
@@ -1563,13 +1539,11 @@ g_irepository_require (GIRepository *repository,
GIRepositoryLoadFlags flags,
GError **error)
{
- GSList *search_path;
GITypelib *typelib;
- search_path = build_search_path_with_overrides ();
+ init_globals ();
typelib = require_internal (repository, namespace, version, flags,
search_path, error);
- g_slist_free (search_path);
return typelib;
}