From ceea1612c4cb7b0c085e8487eb03c2177ad83f3b Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 9 Oct 2001 20:40:19 +0000 Subject: [PATCH] More Unix compatibility: Add "lib" prefix in case the module name doesn't 2001-10-09 Tor Lillqvist * gmodule-win32.c (_g_module_build_path): More Unix compatibility: Add "lib" prefix in case the module name doesn't already have it, except if it ends with ".dll" (in which case it probably already is the name of an existing DLL). This is needed for instance for the gdk-pixbuf loaders, which are called "lib*.dll", but gdk-pixbuf-io calls g_module_build_path without the "lib" prefix. --- gmodule/ChangeLog | 9 +++++++++ gmodule/gmodule-win32.c | 11 ++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gmodule/ChangeLog b/gmodule/ChangeLog index 930ea456..fb9e635c 100644 --- a/gmodule/ChangeLog +++ b/gmodule/ChangeLog @@ -1,3 +1,12 @@ +2001-10-09 Tor Lillqvist + + * gmodule-win32.c (_g_module_build_path): More Unix compatibility: + Add "lib" prefix in case the module name doesn't already have it, + except if it ends with ".dll" (in which case it probably already + is the name of an existing DLL). This is needed for instance for + the gdk-pixbuf loaders, which are called "lib*.dll", but + gdk-pixbuf-io calls g_module_build_path without the "lib" prefix. + 2001-10-03 jacob berkman * libgplugin_a.c: (gplugin_a_module_func): diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c index c665329d..a738b013 100644 --- a/gmodule/gmodule-win32.c +++ b/gmodule/gmodule-win32.c @@ -249,15 +249,20 @@ _g_module_build_path (const gchar *directory, const gchar *module_name) { gint k; - + k = strlen (module_name); + if (directory && *directory) if (k > 4 && g_strcasecmp (module_name + k - 4, ".dll") == 0) return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, NULL); - else + else if (strncmp (module_name, "lib", 3) == 0) return g_strconcat (directory, G_DIR_SEPARATOR_S, module_name, ".dll", NULL); + else + return g_strconcat (directory, G_DIR_SEPARATOR_S, "lib", module_name, ".dll", NULL); else if (k > 4 && g_strcasecmp (module_name + k - 4, ".dll") == 0) return g_strdup (module_name); - else + else if (strncmp (module_name, "lib", 3) == 0) return g_strconcat (module_name, ".dll", NULL); + else + return g_strconcat ("lib", module_name, ".dll", NULL); } -- 2.34.1