gobject-introspection r786 - in trunk: . gir girepository



Author: jobi
Date: Thu Oct 23 09:10:04 2008
New Revision: 786
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=786&view=rev

Log:

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.



Modified:
   trunk/ChangeLog
   trunk/gir/Makefile.am
   trunk/girepository/girepository.c

Modified: trunk/gir/Makefile.am
==============================================================================
--- trunk/gir/Makefile.am	(original)
+++ trunk/gir/Makefile.am	Thu Oct 23 09:10:04 2008
@@ -121,7 +121,7 @@
 %.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT) Makefile
 	$(DEBUG) $(top_builddir)/tools/g-ir-compiler$(EXEEXT) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $@
 
-typelibsdir = $(datadir)/girepository
+typelibsdir = $(libdir)/girepository
 typelibs_DATA = GLib-2.0.typelib GModule-2.0.typelib GObject-2.0.typelib Gio-2.0.typelib
 CLEANFILES += $(typelibs_DATA)
 

Modified: trunk/girepository/girepository.c
==============================================================================
--- trunk/girepository/girepository.c	(original)
+++ trunk/girepository/girepository.c	Thu Oct 23 09:10:04 2008
@@ -84,8 +84,8 @@
 {
   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 @@
     {
       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);
     }
 



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