[glade] try_load_library () only check for file if library_path is not null
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] try_load_library () only check for file if library_path is not null
- Date: Fri, 18 May 2012 03:14:21 +0000 (UTC)
commit 0060c3f08ee5d416e8023e8700009af7fc99f429
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Fri May 18 00:13:35 2012 -0300
try_load_library () only check for file if library_path is not null
gladeui/glade-utils.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c
index 8d85118..6de3ca6 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]