summaryrefslogtreecommitdiff
path: root/gladeui
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <juanpablougarte@gmail.com>2012-05-18 00:13:35 -0300
committerJuan Pablo Ugarte <juanpablougarte@gmail.com>2012-05-18 00:13:35 -0300
commit0060c3f08ee5d416e8023e8700009af7fc99f429 (patch)
treee3bdbad22525485408249a11a6a2c9a0b009ac07 /gladeui
parentc50a7358e686655234c4693690815c58f81052e2 (diff)
downloadglade-0060c3f08ee5d416e8023e8700009af7fc99f429.tar.gz
try_load_library () only check for file if library_path is not null
Diffstat (limited to 'gladeui')
-rw-r--r--gladeui/glade-utils.c23
1 files changed, 11 insertions, 12 deletions
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;