More Unix compatibility: Add "lib" prefix in case the module name doesn't
authorTor Lillqvist <tml@iki.fi>
Tue, 9 Oct 2001 20:40:19 +0000 (20:40 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Tue, 9 Oct 2001 20:40:19 +0000 (20:40 +0000)
2001-10-09  Tor Lillqvist  <tml@iki.fi>

* 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
gmodule/gmodule-win32.c

index 930ea45..fb9e635 100644 (file)
@@ -1,3 +1,12 @@
+2001-10-09  Tor Lillqvist  <tml@iki.fi>
+
+       * 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  <jacob@ximian.com>
 
        * libgplugin_a.c: (gplugin_a_module_func): 
index c665329..a738b01 100644 (file)
@@ -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);
 }