diff options
author | Owen Taylor <otaylor@redhat.com> | 2002-03-03 03:17:22 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-03-03 03:17:22 +0000 |
commit | b3c0813b93a2aa0f39a6b06128e2b7ad9cca9175 (patch) | |
tree | 79bc7071bddd431aae8d73ae5cf10a64db70a917 /gdk-pixbuf/gdk-pixbuf-io.c | |
parent | 76cf3d95f6f5daf4f3f0663f3718ce7cb2198b19 (diff) | |
download | gdk-pixbuf-b3c0813b93a2aa0f39a6b06128e2b7ad9cca9175.tar.gz |
If we can't load the module using the g_module_build_path() filename, try
Sat Mar 2 22:11:10 2002 Owen Taylor <otaylor@redhat.com>
* gdk-pixbuf-io.c (_gdk_pixbuf_load_module): If we
can't load the module using the g_module_build_path()
filename, try loading it as a .la file.
* test-loaders.c: Look for modules in current directory
rather than .libs, so we find the right .la files.
* test-loaders.c: Back out some accidental commits.
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf-io.c')
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-io.c | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c index 539b21285..13e02f6f0 100644 --- a/gdk-pixbuf/gdk-pixbuf-io.c +++ b/gdk-pixbuf/gdk-pixbuf-io.c @@ -279,6 +279,31 @@ get_libdir (void) #endif +/* Like g_module_path, but use .la as the suffix + */ +static gchar* +module_build_la_path (const gchar *directory, + const gchar *module_name) +{ + gchar *filename; + gchar *result; + + if (strncmp (module_name, "lib", 3) == 0) + filename = (gchar *)module_name; + else + filename = g_strconcat ("lib", module_name, ".la", NULL); + + if (directory && *directory) + result = g_build_filename (directory, filename, NULL); + else + result = g_strdup (filename); + + if (filename != module_name) + g_free (filename); + + return result; +} + /* actually load the image handler - gdk_pixbuf_get_module only get a */ /* reference to the module to load, it doesn't actually load it */ /* perhaps these actions should be combined in one function */ @@ -307,17 +332,22 @@ _gdk_pixbuf_load_module (GdkPixbufModule *image_module, * itself. */ dir = g_getenv ("GDK_PIXBUF_MODULEDIR"); + if (dir == NULL || *dir == '\0') + dir = PIXBUF_LIBDIR; - if (dir == NULL || *dir == '\0') { - - path = g_module_build_path (PIXBUF_LIBDIR, module_name); - module = g_module_open (path, G_MODULE_BIND_LAZY); - } else { - path = g_module_build_path (dir, module_name); - module = g_module_open (path, G_MODULE_BIND_LAZY); - } + path = g_module_build_path (dir, module_name); + module = g_module_open (path, G_MODULE_BIND_LAZY); + if (!module) { + g_free (path); + path = module_build_la_path (dir, module_name); + module = g_module_open (path, G_MODULE_BIND_LAZY); + } + if (!module) { + g_free (path); + path = g_module_build_path (dir, module_name); + g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, |