[glib/wip/gcleanup: 45/71] giomodule: Allow overriding source directory gio modules are loaded from
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/gcleanup: 45/71] giomodule: Allow overriding source directory gio modules are loaded from
- Date: Wed, 13 Nov 2013 11:38:02 +0000 (UTC)
commit 2b6112778444ea35e86ce66542231fe5d6ece563
Author: Stef Walter <stefw gnome org>
Date: Fri Nov 8 14:26:33 2013 +0100
giomodule: Allow overriding source directory gio modules are loaded from
When testing (and valgrinding) we need to have a known set of modules
loaded.
https://bugzilla.gnome.org/show_bug.cgi?id=711801
docs/reference/gio/overview.xml | 12 +++++++++++-
gio/giomodule.c | 7 ++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/docs/reference/gio/overview.xml b/docs/reference/gio/overview.xml
index dcb1bdb..a72bcc6 100644
--- a/docs/reference/gio/overview.xml
+++ b/docs/reference/gio/overview.xml
@@ -363,12 +363,22 @@ Gvfs is also heavily distributed and relies on a session bus to be present.
</formalpara>
<formalpara>
+ <title><envar>GIO_MODULE_DIR</envar></title>
+
+ <para>
+ When this environment variable is set to a path, GIO will load
+ modules from this alternate directory instead of the directory
+ built into GIO. This is useful when running tests, for example.
+ </para>
+ </formalpara>
+
+ <formalpara>
<title><envar>GIO_EXTRA_MODULES</envar></title>
<para>
When this environment variable is set to a path, or a set of
paths separated by a colon, GIO will attempt to load
- modules from within the path.
+ additional modules from within the path.
</para>
</formalpara>
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 3e2efe8..c26d3d2 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -1020,6 +1020,7 @@ _g_io_modules_ensure_loaded (void)
static gboolean loaded_dirs = FALSE;
const char *module_path;
GIOModuleScope *scope;
+ const gchar *module_dir;
_g_io_modules_ensure_extension_points_registered ();
@@ -1048,7 +1049,11 @@ _g_io_modules_ensure_loaded (void)
}
/* Then load the compiled in path */
- g_io_modules_scan_all_in_directory_with_scope (GIO_MODULE_DIR, scope);
+ module_dir = g_getenv ("GIO_MODULE_DIR");
+ if (module_dir == NULL)
+ module_dir = GIO_MODULE_DIR;
+
+ g_io_modules_scan_all_in_directory_with_scope (module_dir, scope);
g_io_module_scope_free (scope);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]