mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-02 07:36:17 +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:
parent
a44ff6ef33
commit
bc8e1dd8c1
@ -1,3 +1,11 @@
|
||||
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.
|
||||
|
||||
2008-09-18 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* configure.in: Bump version to 2.19.0
|
||||
|
@ -551,8 +551,8 @@ do_spawn_with_pipes (gint *exit_status,
|
||||
gchar *helper_process;
|
||||
CONSOLE_CURSOR_INFO cursor_info;
|
||||
wchar_t *whelper, **wargv, **wenvp;
|
||||
extern gchar *_glib_get_installation_directory (void);
|
||||
gchar *glib_top;
|
||||
extern gchar *_glib_get_dll_directory (void);
|
||||
gchar *glib_dll_directory;
|
||||
|
||||
if (child_setup && !warned_about_child_setup)
|
||||
{
|
||||
@ -600,11 +600,11 @@ do_spawn_with_pipes (gint *exit_status,
|
||||
else
|
||||
helper_process = HELPER_PROCESS ".exe";
|
||||
|
||||
glib_top = _glib_get_installation_directory ();
|
||||
if (glib_top != NULL)
|
||||
glib_dll_directory = _glib_get_dll_directory ();
|
||||
if (glib_dll_directory != NULL)
|
||||
{
|
||||
helper_process = g_build_filename (glib_top, "bin", helper_process, NULL);
|
||||
g_free (glib_top);
|
||||
helper_process = g_build_filename (glib_dll_directory, helper_process, NULL);
|
||||
g_free (glib_dll_directory);
|
||||
}
|
||||
else
|
||||
helper_process = g_strdup (helper_process);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user