26 #ifndef __pbd_gstdio_compat_h__
27 #define __pbd_gstdio_compat_h__
29 #include <glib/gstdio.h>
34 #if defined(_WIN32) && !defined(_MSC_VER) && !defined(_WIN64)
35 typedef struct _stat GStatBufW32;
37 pbd_g_stat(
const gchar *filename, GStatBufW32 *buf)
39 return g_stat(filename, (GStatBuf*)buf);
41 # define GStatBuf GStatBufW32
42 # define g_stat pbd_g_stat
43 # define g_lstat pbd_g_stat
55 #if defined(_WIN32) && !defined(_MSC_VER) && defined(_WIN64) && !GLIB_CHECK_VERSION (2,64,1)
60 typedef struct _stat GStatBufW64;
62 pbd_g_stat(
const gchar* filename, GStatBufW64* buf)
64 gunichar2* wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
65 if (wfilename == NULL) {
70 int len = wcslen ((
wchar_t*)wfilename);
71 while (len > 0 && G_IS_DIR_SEPARATOR (wfilename[len-1])) {
74 if (len > 0 && (!g_path_is_absolute (filename) || len > g_path_skip_root (filename) - filename)) {
75 wfilename[len] =
'\0';
78 int retval = _wstat ((
wchar_t*)wfilename, buf);
79 int save_errno = errno;
84 # define GStatBuf GStatBufW64
85 # define g_stat pbd_g_stat
86 # define g_lstat pbd_g_stat