diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-06-23 05:07:06 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-06-23 05:07:06 +0400 |
commit | 77f357728f708dd7a19a62110f34fa9afa5e9213 (patch) | |
tree | 5a3ef21544f4141ab13bfc12f69b7de6000e8b9a /source/blender/blenlib/intern/winstuff_dir.c | |
parent | 489937e1e7f89b3c21a4e13feaffbd400527f118 (diff) |
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
Diffstat (limited to 'source/blender/blenlib/intern/winstuff_dir.c')
-rw-r--r-- | source/blender/blenlib/intern/winstuff_dir.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/winstuff_dir.c b/source/blender/blenlib/intern/winstuff_dir.c index 90250de1683..3d669a869f9 100644 --- a/source/blender/blenlib/intern/winstuff_dir.c +++ b/source/blender/blenlib/intern/winstuff_dir.c @@ -28,7 +28,7 @@ * (opendir, readdir, closedir) */ -#if defined(WIN32) && !defined(FREE_WINDOWS) +#ifdef WIN32 /* standalone for inclusion in binaries other then blender */ # ifdef USE_STANDALONE @@ -44,6 +44,13 @@ #include "BLI_utildefines.h" #include "utfconv.h" +/* Note: 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 +* characters. (kjym3) +*/ + DIR *opendir(const char *path) { wchar_t *path_16 = alloc_utf16_from_8(path, 0); |