From 0060c3f08ee5d416e8023e8700009af7fc99f429 Mon Sep 17 00:00:00 2001 From: Juan Pablo Ugarte Date: Fri, 18 May 2012 00:13:35 -0300 Subject: try_load_library () only check for file if library_path is not null --- gladeui/glade-utils.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'gladeui') diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c index 8d85118e..6de3ca69 100644 --- a/gladeui/glade-utils.c +++ b/gladeui/glade-utils.c @@ -851,15 +851,15 @@ glade_util_canonical_path (const gchar *path) static GModule * try_load_library (const gchar *library_path, const gchar *library_name) { + gchar *path = g_module_build_path (library_path, library_name); GModule *module = NULL; - 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 ()); } + g_free (path); return module; @@ -880,15 +880,6 @@ try_load_library (const gchar *library_path, const gchar *library_name) GModule * glade_util_load_library (const gchar *library_name) { - const gchar *paths[] = - { - glade_app_get_modules_dir (), - glade_app_get_lib_dir (), -#ifndef G_OS_WIN32 - "/usr/local/lib", /* Try local lib dir on Unices */ -#endif - NULL /* Use default system paths */ - }; GModule *module = NULL; const gchar *search_path; gint i; @@ -909,6 +900,14 @@ glade_util_load_library (const gchar *library_name) if (!module) { + const gchar *paths[] = { glade_app_get_modules_dir (), + glade_app_get_lib_dir (), +#ifndef G_OS_WIN32 /* Try local lib dir on Unices */ + "/usr/local/lib", +#endif + NULL}; /* Use default system paths */ + + for (i = 0; i < G_N_ELEMENTS (paths); i++) if ((module = try_load_library (paths[i], library_name)) != NULL) break; -- cgit v1.2.1