Fix T42021: OSL doesn't work when there are non-ascii chars in the path

Quite annoying, the same thing we do from the blender side, But as a positive
side we can get rid of some utf8/utf16 conversions.

Hopefully it all work fine now, at leats works on mu russki windoze laptop.
This commit is contained in:
2014-10-14 14:53:49 +02:00
parent e0cacb808c
commit 383bd34111
2 changed files with 26 additions and 20 deletions

View File

@@ -41,21 +41,12 @@ static string cached_user_path = "";
static boost::filesystem::path to_boost(const string& path)
{
#ifdef _MSC_VER
std::wstring path_utf16 = Strutil::utf8_to_utf16(path.c_str());
return boost::filesystem::path(path_utf16.c_str());
#else
return boost::filesystem::path(path.c_str());
#endif
}
static string from_boost(const boost::filesystem::path& path)
{
#ifdef _MSC_VER
return Strutil::utf16_to_utf8(path.wstring().c_str());
#else
return path.string().c_str();
#endif
}
void path_init(const string& path, const string& user_path)
@@ -259,14 +250,7 @@ string path_source_replace_includes(const string& source_, const string& path)
FILE *path_fopen(const string& path, const string& mode)
{
#ifdef _WIN32
std::wstring path_utf16 = Strutil::utf8_to_utf16(path);
std::wstring mode_utf16 = Strutil::utf8_to_utf16(mode);
return _wfopen(path_utf16.c_str(), mode_utf16.c_str());
#else
return fopen(path.c_str(), mode.c_str());
#endif
}
void path_cache_clear_except(const string& name, const set<string>& except)