mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-24 01:48:53 +02:00
Add macros G_WIN32_DLLMAIN_FOR_DLL_NAME and G_HARDCODED_PATH_WRAPPER.
2001-10-23 Tor Lillqvist <tml@iki.fi> * glib/gutils.h: Add macros G_WIN32_DLLMAIN_FOR_DLL_NAME and G_HARDCODED_PATH_WRAPPER. These are used to avoid hardcoding path names into Windows DLLs. * glib/gutils.c: Use them for GLIB_LOCALEDIR. * glib/gwin32.c (get_package_directory_from_module): Plug a small memory leak. Minor code reordering. (g_win32_get_package_installation_subdirectory): Allow empty subdir.
This commit is contained in:
committed by
Tor Lillqvist
parent
a0b08581c0
commit
3984621bd3
@@ -611,9 +611,18 @@ get_package_directory_from_module (gchar *module_name)
|
||||
if (!GetModuleFileName (hmodule, fn, MAX_PATH))
|
||||
{
|
||||
G_UNLOCK (module_dirs);
|
||||
g_free (fn);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((p = strrchr (fn, G_DIR_SEPARATOR)) != NULL)
|
||||
*p = '\0';
|
||||
|
||||
p = strrchr (fn, G_DIR_SEPARATOR);
|
||||
if (p && (g_ascii_strcasecmp (p + 1, "bin") == 0 ||
|
||||
g_ascii_strcasecmp (p + 1, "lib") == 0))
|
||||
*p = '\0';
|
||||
|
||||
#ifdef G_WITH_CYGWIN
|
||||
/* In Cygwin we need to have POSIX paths */
|
||||
{
|
||||
@@ -625,14 +634,6 @@ get_package_directory_from_module (gchar *module_name)
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((p = strrchr (fn, G_DIR_SEPARATOR)) != NULL)
|
||||
*p = '\0';
|
||||
|
||||
p = strrchr (fn, G_DIR_SEPARATOR);
|
||||
if (p && (g_ascii_strcasecmp (p + 1, "bin") == 0 ||
|
||||
g_ascii_strcasecmp (p + 1, "lib") == 0))
|
||||
*p = '\0';
|
||||
|
||||
g_hash_table_insert (module_dirs, module_name ? module_name : "", fn);
|
||||
|
||||
G_UNLOCK (module_dirs);
|
||||
@@ -770,7 +771,7 @@ g_win32_get_package_installation_subdirectory (gchar *package,
|
||||
|
||||
prefix = g_win32_get_package_installation_directory (package, dll_name);
|
||||
|
||||
sep = (prefix[strlen (prefix) - 1] == G_DIR_SEPARATOR ?
|
||||
sep = ((subdir != NULL && strlen (subdir) > 0) || prefix[strlen (prefix) - 1] == G_DIR_SEPARATOR ?
|
||||
"" : G_DIR_SEPARATOR_S);
|
||||
|
||||
return g_strconcat (prefix, sep, subdir, NULL);
|
||||
|
Reference in New Issue
Block a user