mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-03 01:42:18 +01:00
glib/gutils.c (_glib_get_dll_directory) Be a bit less restrictive, look
2008-09-19 Tor Lillqvist <tml@novell.com> * glib/gutils.c (_glib_get_dll_directory) * glib/gspawn-win32.c (do_spawn_with_pipes): Be a bit less restrictive, look for the helper programs in the same folder where the GLib DLL is, not necessarily in a "bin" subfolder of the top GLib installation folder. svn path=/trunk/; revision=7511
This commit is contained in:
committed by
Tor Lillqvist
parent
a44ff6ef33
commit
bc8e1dd8c1
@@ -150,16 +150,40 @@ DllMain (HINSTANCE hinstDLL,
|
||||
#endif
|
||||
|
||||
gchar *
|
||||
_glib_get_installation_directory (void)
|
||||
_glib_get_dll_directory (void)
|
||||
{
|
||||
gchar *retval;
|
||||
gchar *p;
|
||||
wchar_t wc_fn[MAX_PATH];
|
||||
|
||||
#ifdef DLL_EXPORT
|
||||
if (glib_dll == NULL)
|
||||
return NULL;
|
||||
#endif
|
||||
/* In a static build of GLib just use the application's .exe file's
|
||||
* installation directory...
|
||||
|
||||
/* This code is different from that in
|
||||
* g_win32_get_package_installation_directory_of_module() in that
|
||||
* here we return the actual folder where the GLib DLL is. We don't
|
||||
* do the check for it being in a "bin" or "lib" subfolder and then
|
||||
* returning the parent of that.
|
||||
*
|
||||
* In a statically built GLib, glib_dll will be NULL and we will
|
||||
* thus look up the application's .exe file's location.
|
||||
*/
|
||||
return g_win32_get_package_installation_directory_of_module (glib_dll);
|
||||
if (!GetModuleFileNameW (glib_dll, wc_fn, MAX_PATH))
|
||||
return NULL;
|
||||
|
||||
retval = g_utf16_to_utf8 (wc_fn, -1, NULL, NULL, NULL);
|
||||
|
||||
p = strrchr (retval, G_DIR_SEPARATOR);
|
||||
if (p == NULL)
|
||||
{
|
||||
/* Wtf? */
|
||||
return NULL;
|
||||
}
|
||||
*p = '\0';
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user