diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-01 21:43:33 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-01 21:43:33 +0400 |
commit | 34b5bd7283f6384606571a0803ad01368da23ae3 (patch) | |
tree | 442f49cf7154ec1908830fc982f85fae3cfb57b1 | |
parent | 75aeb37a18c7e91ec3c648bb5a28417ab9d46aac (diff) |
Fix #35081: opening .blend files with chinese characters not working. For
compressed files we were not passing the full wide char path to zlib, so not
all file names worked. Now we use gzopen_w available in new zlib versions.
Patch by Tamito Kajiyama, I added an extra check for the zlib version so it
keeps compiling with older versions for now.
For platform maintainers:
Part of this commit are zlib 1.2.8 libraries for windows 32 bit. We still
need update libraries for windows 64 bit and mingw. There's a readme.txt
and build.bat included with instructions on how to build.
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index ae6404153c8..a8e233d214b 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -247,15 +247,25 @@ void *BLI_gzopen(const char *filename, const char *mode) return 0; } else { - char short_name[256]; - /* xxx Creates file before transcribing the path */ if (mode[0] == 'w') fclose(ufopen(filename, "a")); - BLI_get_short_name(short_name, filename); + /* temporary #if until we update all libraries to 1.2.7 + * for correct wide char path handling */ +#if ZLIB_VERNUM >= 0x1270 + UTF16_ENCODE(filename); + + gzfile = gzopen_w(filename_16, mode); - gzfile = gzopen(short_name, mode); + UTF16_UN_ENCODE(filename); +#else + { + char short_name[256]; + BLI_get_short_name(short_name, filename); + gzfile = gzopen(short_name, mode); + } +#endif } return gzfile; |