28 #include <glib/gstdio.h>
33 #if defined(_WIN32) && !defined(_MSC_VER) && !defined(_WIN64)
34 typedef struct _stat GStatBufW32;
36 pbd_g_stat(
const gchar *filename, GStatBufW32 *buf)
38 return g_stat(filename, (GStatBuf*)buf);
40 # define GStatBuf GStatBufW32
41 # define g_stat pbd_g_stat
42 # define g_lstat pbd_g_stat
54 #if defined(_WIN32) && !defined(_MSC_VER) && defined(_WIN64) && !GLIB_CHECK_VERSION (2,64,1)
59 typedef struct _stat GStatBufW64;
61 pbd_g_stat(
const gchar* filename, GStatBufW64* buf)
63 gunichar2* wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
64 if (wfilename == NULL) {
69 int len = wcslen ((
wchar_t*)wfilename);
70 while (len > 0 && G_IS_DIR_SEPARATOR (wfilename[len-1])) {
73 if (len > 0 && (!g_path_is_absolute (filename) || len > g_path_skip_root (filename) - filename)) {
74 wfilename[len] =
'\0';
77 int retval = _wstat ((
wchar_t*)wfilename, buf);
78 int save_errno = errno;
83 # define GStatBuf GStatBufW64
84 # define g_stat pbd_g_stat
85 # define g_lstat pbd_g_stat