56 char *resolved = realpath(path, NULL);
60 fprintf(stderr,
"path lookup '%s' fails with: '%s'\n", path, strerror(errno));
64 gchar *result = g_strdup(resolved);
71 wchar_t *wpath = g_utf8_to_utf16(path, -1, NULL, NULL, NULL);
76 const DWORD needed = GetFullPathNameW(wpath, 0, NULL, NULL);
80 return g_strdup(path);
83 wchar_t *wbuffer = g_new(
wchar_t, needed);
84 const DWORD written = GetFullPathNameW(wpath, needed, wbuffer, NULL);
87 if(written == 0 || written >= needed)
90 return g_strdup(path);
93 gchar *result = g_utf16_to_utf8(wbuffer, -1, NULL, NULL, NULL);
95 return IS_NULL_PTR(result) ? g_strdup(path) : result;