Fix T47856: Cycles problem when running from multi-byte path

This is a mix of regression and old unsupported configuration.

Regression was caused by some checks added on Blender side which was
checking whether python function returned error or not. This made it
impossible to enable Cycles when running from a file path which can't
be encoded with MBCS codepage.

Non-regression issue was that it wasn't possible to use pre-compiled
CUDA kernels when running from a path with non-ascii multi-byte
characters.

This commit fixes regression and CUDA parts, but OSL still can't be
used from a non-ascii location because it uses non-widechar API to
work with file paths by the looks of it. Not sure we can solve this
just from our side by using some codepage trick (UTF-16?) since even
oslc fails to compile shader when there are non-ascii characters in
the path.
This commit is contained in:
2016-03-23 13:58:31 +01:00
parent 6e31f4f090
commit 21f31e6054
5 changed files with 92 additions and 18 deletions

View File

@@ -56,7 +56,6 @@ typedef struct _stat path_stat_t;
# ifndef S_ISDIR
# define S_ISDIR(x) (((x) & _S_IFDIR) == _S_IFDIR)
# endif
# define mkdir(path, mode) _mkdir(path)
#else
typedef struct stat path_stat_t;
#endif
@@ -626,7 +625,12 @@ static bool create_directories_recursivey(const string& path)
}
}
#ifdef _WIN32
wstring path_wc = string_to_wstring(path);
return _wmkdir(path_wc.c_str()) == 0;
#else
return mkdir(path.c_str(), 0777) == 0;
#endif
}
void path_create_directories(const string& filepath)
@@ -745,7 +749,13 @@ string path_source_replace_includes(const string& source_, const string& path)
FILE *path_fopen(const string& path, const string& mode)
{
#ifdef _WIN32
wstring path_wc = string_to_wstring(path);
wstring mode_wc = string_to_wstring(mode);
return _wfopen(path_wc.c_str(), mode_wc.c_str());
#else
return fopen(path.c_str(), mode.c_str());
#endif
}
void path_cache_clear_except(const string& name, const set<string>& except)