Merge #13866: utils: Use _wfopen and _wfreopen on Windows
b9babc82dd
utils: Use _wfopen and _wreopen on Windows (Chun Kuan Lee)
Pull request description:
The fopen function does not support unicode filename on Windows, so use Windows specific function do deal with it.
Tree-SHA512: 4dcf14dcf9ec6307b9fdf95404e5b6b6b3df640949fd4b0c4ac7fecf8ea03a64fa25285fc319c4ff8a28e586eee106f1861116c181694955497402b2bf575f22
This commit is contained in:
commit
3783b139e9
1 changed files with 5 additions and 0 deletions
|
@ -11,7 +11,12 @@ namespace fsbridge {
|
|||
|
||||
FILE *fopen(const fs::path& p, const char *mode)
|
||||
{
|
||||
#ifndef WIN32
|
||||
return ::fopen(p.string().c_str(), mode);
|
||||
#else
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t> utf8_cvt;
|
||||
return ::_wfopen(p.wstring().c_str(), utf8_cvt.from_bytes(mode).c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
|
|
Loading…
Reference in a new issue