diff --git a/docs/reference/gio/overview.xml b/docs/reference/gio/overview.xml
index dcb1bdb73..a72bcc6c6 100644
--- a/docs/reference/gio/overview.xml
+++ b/docs/reference/gio/overview.xml
@@ -362,13 +362,23 @@ Gvfs is also heavily distributed and relies on a session bus to be present.
+
+ GIO_MODULE_DIR
+
+
+ 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.
+
+
+
GIO_EXTRA_MODULES
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.
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 17d55de6e..24986598e 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -1017,6 +1017,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 ();
@@ -1045,7 +1046,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);