[glade/glade-3-12] Fixed bug #675977 "Don't hard-code library search paths"
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/glade-3-12] Fixed bug #675977 "Don't hard-code library search paths"
- Date: Fri, 18 May 2012 03:13:24 +0000 (UTC)
commit 25c5b5a36719e7beb8603818538846ca15eabf49
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Fri May 18 00:02:37 2012 -0300
Fixed bug #675977 "Don't hard-code library search paths"
gladeui/glade-utils.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c
index bf9542e..888cf12 100644
--- a/gladeui/glade-utils.c
+++ b/gladeui/glade-utils.c
@@ -855,7 +855,7 @@ try_load_library (const gchar *library_path, const gchar *library_name)
gchar *path;
path = g_module_build_path (library_path, library_name);
- if (g_file_test (path, G_FILE_TEST_EXISTS))
+ if (!library_path || g_file_test (path, G_FILE_TEST_EXISTS))
{
if (!(module = g_module_open (path, G_MODULE_BIND_LAZY)))
g_warning ("Failed to load %s: %s", path, g_module_error ());
@@ -882,19 +882,15 @@ glade_util_load_library (const gchar *library_name)
{
gchar *default_paths[] = { (gchar *) glade_app_get_modules_dir (),
NULL, /* <-- dynamically allocated */
- "/lib",
- "/usr/lib",
"/usr/local/lib",
NULL
};
-
+
GModule *module = NULL;
const gchar *search_path;
gchar **split;
gint i;
-
-
if ((search_path = g_getenv (GLADE_ENV_MODULE_PATH)) != NULL)
{
if ((split = g_strsplit (search_path, ":", 0)) != NULL)
@@ -913,7 +909,7 @@ glade_util_load_library (const gchar *library_name)
default_paths[1] =
g_build_filename (glade_app_get_modules_dir (), "..", "..", NULL);
- for (i = 0; default_paths[i] != NULL; i++)
+ for (i = 0; i < G_N_ELEMENTS (default_paths); i++)
if ((module =
try_load_library (default_paths[i], library_name)) != NULL)
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]