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
This commit is contained in:
@@ -60,17 +60,23 @@ int BLI_delete(const char *path, bool dir, bool recursive);
|
||||
int BLI_move(const char *path, const char *to);
|
||||
int BLI_create_symlink(const char *path, const char *to);
|
||||
|
||||
/* keep in sync with the definition of struct direntry in BLI_fileops_types.h */
|
||||
#ifdef WIN32
|
||||
# ifndef __MINGW64__
|
||||
# if (defined(_MSC_VER) && (_MSC_VER >= 1500)) || defined(__MINGW64__)
|
||||
typedef struct _stat64 BLI_stat_t;
|
||||
# elif defined(__MINGW32__)
|
||||
typedef struct _stati64 BLI_stat_t;
|
||||
# else
|
||||
typedef struct stat BLI_stat_t;
|
||||
#endif
|
||||
typedef struct _stat BLI_stat_t;
|
||||
# endif
|
||||
#else
|
||||
typedef struct stat BLI_stat_t;
|
||||
#endif
|
||||
|
||||
int BLI_stat(const char *path, BLI_stat_t *buffer);
|
||||
#ifdef WIN32
|
||||
int BLI_wstat(const wchar_t *path, BLI_stat_t *buffer);
|
||||
#endif
|
||||
|
||||
/* Directories */
|
||||
|
||||
|
Reference in New Issue
Block a user