aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-09-11 09:01:26 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-09-11 09:02:26 +0200
commit3783b139e9ec577472a1809fa372e4016f0cbec9 (patch)
tree050a8c1d4915929f81dac5dd19e86422a31025b0 /src
parent7ab2837b65217e6bf010512c4ea44b09cad69bad (diff)
parentb9babc82dd6a0a4f6f623fcbe5330962eb37eccf (diff)
Merge #13866: utils: Use _wfopen and _wfreopen on Windows
b9babc82dd6a0a4f6f623fcbe5330962eb37eccf 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
Diffstat (limited to 'src')
-rw-r--r--src/fs.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/fs.cpp b/src/fs.cpp
index 2dbc13643b..a34a88216a 100644
--- a/src/fs.cpp
+++ b/src/fs.cpp
@@ -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