glib r7511 - in trunk: . glib
- From: tml svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7511 - in trunk: . glib
- Date: Fri, 19 Sep 2008 10:20:41 +0000 (UTC)
Author: tml
Date: Fri Sep 19 10:20:41 2008
New Revision: 7511
URL: http://svn.gnome.org/viewvc/glib?rev=7511&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/glib/gspawn-win32.c
trunk/glib/gutils.c
Modified: trunk/glib/gspawn-win32.c
==============================================================================
--- trunk/glib/gspawn-win32.c (original)
+++ trunk/glib/gspawn-win32.c Fri Sep 19 10:20:41 2008
@@ -551,8 +551,8 @@
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 @@
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);
Modified: trunk/glib/gutils.c
==============================================================================
--- trunk/glib/gutils.c (original)
+++ trunk/glib/gutils.c Fri Sep 19 10:20:41 2008
@@ -150,16 +150,40 @@
#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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]