diff options
| author | Chun Kuan Lee <[email protected]> | 2018-07-26 21:39:13 +0800 |
|---|---|---|
| committer | Chun Kuan Lee <[email protected]> | 2018-08-31 21:02:53 +0800 |
| commit | b9babc82dd6a0a4f6f623fcbe5330962eb37eccf (patch) | |
| tree | a8eddce96c5af77cde83774cc4a9b7eda144cfcd /src/fs.cpp | |
| parent | Merge #14108: tests: Add missing locking annotations and locks (g_cs_orphans) (diff) | |
| download | discoin-b9babc82dd6a0a4f6f623fcbe5330962eb37eccf.tar.xz discoin-b9babc82dd6a0a4f6f623fcbe5330962eb37eccf.zip | |
utils: Use _wfopen and _wreopen on Windows
The fopen function does not support unicode filename on Windows, so use Windows specific function do deal with it
Diffstat (limited to 'src/fs.cpp')
| -rw-r--r-- | src/fs.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/fs.cpp b/src/fs.cpp index 2dbc13643..a34a88216 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 |