mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 16:38:54 +02:00
W32: swap special g_get_prgname() for platform_get_argv0()
Commit398008da
added a W32-only code (from commit7e0e251a
) to g_get_prgname() that makes this function never return NULL. This is inconsistent with the other platforms. Revert the change, and add an implementation for platform_get_argv0(), which is used by GOption when g_get_prgname() == NULL. The W32 platform_get_argv0() code is different from the one that was in g_get_prgname(), because it should be getting argv0, not the name of the executable that is being run (although most of the time they are one and the same). Adjust thest option-argv0 test to expect it to pass on W32.
This commit is contained in:
@@ -1047,29 +1047,6 @@ g_get_prgname (void)
|
||||
gchar* retval;
|
||||
|
||||
G_LOCK (g_prgname);
|
||||
#ifdef G_OS_WIN32
|
||||
if (g_prgname == NULL)
|
||||
{
|
||||
static gboolean beenhere = FALSE;
|
||||
|
||||
if (!beenhere)
|
||||
{
|
||||
gchar *utf8_buf = NULL;
|
||||
wchar_t buf[MAX_PATH+1];
|
||||
|
||||
beenhere = TRUE;
|
||||
if (GetModuleFileNameW (GetModuleHandle (NULL),
|
||||
buf, G_N_ELEMENTS (buf)) > 0)
|
||||
utf8_buf = g_utf16_to_utf8 (buf, -1, NULL, NULL, NULL);
|
||||
|
||||
if (utf8_buf)
|
||||
{
|
||||
g_prgname = g_path_get_basename (utf8_buf);
|
||||
g_free (utf8_buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
retval = g_prgname;
|
||||
G_UNLOCK (g_prgname);
|
||||
|
||||
|
Reference in New Issue
Block a user