From 77f357728f708dd7a19a62110f34fa9afa5e9213 Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Mon, 23 Jun 2014 10:07:06 +0900 Subject: D605: Fixes for proper handling of wchar_t paths in MinGW. * Fixed different not-in-sync #ifdef blocks for struct stat variants under Windows. Comments have been left to indicate the portions of BLI_fileops.h and BLI_fileops_types.h that need to stay in sync. * Added BLI_wstat() to de-duplicate #ifdef blocks for stat() variants on Windows. * Fix for opendir() and associate functions in MinGW not working properly with non-ASCII, MBCS-compatible paths. MinGW (FREE_WINDOWS) has opendir() and _wopendir(), and only the latter accepts a path name of wchar_t type. Rather than messing up with extra #ifdef's here and there, Blender's own implementations of opendir() and related functions are used to properly support paths with non-ASCII, MBCS-compatible characters. Tested with MSVC 2013 Express, MinGW32 (gcc 4.6.2) and MinGW-w64 (gcc 4.7.1). Differential Revision: https://developer.blender.org/D605 Reviewed By: campbellbarton --- source/blender/blenlib/BLI_fileops_types.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/blender/blenlib/BLI_fileops_types.h') diff --git a/source/blender/blenlib/BLI_fileops_types.h b/source/blender/blenlib/BLI_fileops_types.h index a7372c01e52..53c9fa16b70 100644 --- a/source/blender/blenlib/BLI_fileops_types.h +++ b/source/blender/blenlib/BLI_fileops_types.h @@ -45,12 +45,16 @@ struct direntry { mode_t type; char *relname; char *path; -#if (defined(WIN32) || defined(WIN64)) && !defined(__MINGW32__) && (_MSC_VER >= 1500) +#ifdef WIN32 /* keep in sync with the definition of BLI_stat_t in BLI_fileops.h */ +# if (defined(_MSC_VER) && (_MSC_VER >= 1500)) || defined(__MINGW64__) struct _stat64 s; -#elif defined(__MINGW32__) +# elif defined(__MINGW32__) struct _stati64 s; +# else + struct _stat s; +# endif #else - struct stat s; + struct stat s; #endif unsigned int flags; char size[16]; -- cgit v1.2.3