summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2001-10-31 21:32:08 +0000
committerTor Lillqvist <tml@src.gnome.org>2001-10-31 21:32:08 +0000
commit22865210cbef2f0d1c0d5f481e798390f1b4f059 (patch)
tree62656f887ccb1611fd62514977f94e5aa5ef2546 /pango
parent60fa0fcfd1446e404ea434e47fe8c4e6dc75be35 (diff)
downloadpango-22865210cbef2f0d1c0d5f481e798390f1b4f059.tar.gz
Neat Win32 feature: A prebuilt Pango package can be installed in a random
2001-10-31 Tor Lillqvist <tml@iki.fi> * pango/modules.c (process_module_file): Neat Win32 feature: A prebuilt Pango package can be installed in a random location (i.e., not the same used when configuring and building the software). The pango.modules file provided with the package contains paths on the packager's system, not the end-users. We notice this, and replace with the corresponding path in the installation directory on the end-user's machine. * pango/pango-utils.c: Use G_WIN32_DLLMAIN_FOR_DLL_NAME. (pango_get_sysconf_subdirectory,pango_get_lib_subdirectory): No need to call g_path_get_basename on the DLL name, DllMain already does it.
Diffstat (limited to 'pango')
-rw-r--r--pango/modules.c22
-rw-r--r--pango/pango-utils.c30
2 files changed, 27 insertions, 25 deletions
diff --git a/pango/modules.c b/pango/modules.c
index 094b8f5d..b7868dbb 100644
--- a/pango/modules.c
+++ b/pango/modules.c
@@ -244,6 +244,28 @@ process_module_file (FILE *module_file)
{
case 0:
pair->load_info = g_strdup (tmp_buf->str);
+#ifdef G_OS_WIN32
+ if (strncmp (pair->load_info,
+ LIBDIR "/pango/modules/",
+ strlen (LIBDIR "/pango/modules/")) == 0)
+ {
+ /* This is an entry put there by make install on the
+ * packager's system. On Windows a prebuilt Pango
+ * package can be installed in a random
+ * location. The pango.modules file distributed in
+ * such a package contains paths from the package
+ * builder's machine. Replace the path with the real
+ * one on this machine. */
+ gchar *tem = pair->load_info;
+ pair->load_info =
+ g_strconcat (pango_get_lib_subdirectory (),
+ "\\modules\\",
+ tem + strlen (LIBDIR "/pango/modules/"),
+ NULL);
+ g_free (tem);
+ }
+
+#endif
break;
case 1:
pair->info.id = g_strdup (tmp_buf->str);
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 428b983a..e7ee0bab 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -626,37 +626,17 @@ pango_config_key_get (const char *key)
return g_strdup (g_hash_table_lookup (config_hash, key));
}
-#ifdef G_OS_WIN32
-
/* DllMain function needed to tuck away the DLL name */
-static char dll_name[MAX_PATH];
-
-BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
- DWORD fdwReason,
- LPVOID lpvReserved)
-{
- switch (fdwReason)
- {
- case DLL_PROCESS_ATTACH:
- GetModuleFileName ((HMODULE) hinstDLL, dll_name, sizeof (dll_name));
- break;
- }
-
- return TRUE;
-}
+G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name)
-#endif /* G_OS_WIN32 */
/**
* pango_get_sysconf_subdirectory:
*
* On Unix, returns the name of the "pango" subdirectory of SYSCONFDIR
- * (which is set at compile time). On Win32, returns the Pango
- * installation directory (which is set at installation time, and
- * stored in the registry). The returned string should not be
- * freed.
+ * (which is set at compile time). On Win32, returns a subdirectory of
+ * the Pango installation directory.
*
* Return value: the Pango sysconf directory. The returned string should
* not be freed.
@@ -669,7 +649,7 @@ pango_get_sysconf_subdirectory (void)
if (result == NULL)
result = g_win32_get_package_installation_subdirectory
- (PACKAGE " " VERSION, g_path_get_basename (dll_name), "etc\\pango");
+ (PACKAGE " " VERSION, dll_name, "etc\\pango");
return result;
#else
@@ -697,7 +677,7 @@ pango_get_lib_subdirectory (void)
if (result == NULL)
result = g_win32_get_package_installation_subdirectory
- (PACKAGE " " VERSION, g_path_get_basename (dll_name), "lib\\pango");
+ (PACKAGE " " VERSION, dll_name, "lib\\pango");
return result;
#else