2006-12-28 Tor Lillqvist <tml@novell.com>
- * glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME): Use only the wide
+ * glib/gutils.h (G_WIN32_DLLMAIN_FOR_DLL_NAME)
+ * glib/gutils.c (get_windows_directory_root): : Use only the wide
character API here, too.
* glib/gslice.c: Make it compile on Win32 without pthreads: Use a
static char *
get_windows_directory_root (void)
{
- char windowsdir[MAX_PATH];
+ wchar_t wwindowsdir[MAX_PATH];
- if (GetWindowsDirectory (windowsdir, sizeof (windowsdir)))
+ if (GetWindowsDirectoryW (wwindowsdir, G_N_ELEMENTS (wwindowsdir)))
{
/* Usually X:\Windows, but in terminal server environments
* might be an UNC path, AFAIK.
*/
- char *p = (char *) g_path_skip_root (windowsdir);
+ char *windowsdir = g_utf16_to_utf8 (wwindowsdir, -1, NULL, NULL, NULL);
+ char *p;
+
+ if (windowsdir == NULL)
+ return g_strdup ("C:\\");
+
+ p = (char *) g_path_skip_root (windowsdir);
if (G_IS_DIR_SEPARATOR (p[-1]) && p[-2] != ':')
p--;
*p = '\0';
- return g_strdup (windowsdir);
+ return windowsdir;
}
else
return g_strdup ("C:\\");