More Unix compatibility: Add "lib" prefix in case the module name doesn't

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.
This commit is contained in:
Tor Lillqvist 2001-10-09 20:40:19 +00:00 committed by Tor Lillqvist
parent a033f12d13
commit ceea1612c4
2 changed files with 17 additions and 3 deletions

View 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):

View 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);
}