Changeset View
Changeset View
Standalone View
Standalone View
src/fs.cpp
Show All 14 Lines | |||||
#endif | #endif | ||||
#include <codecvt> | #include <codecvt> | ||||
#include <windows.h> | #include <windows.h> | ||||
#endif | #endif | ||||
namespace fsbridge { | namespace fsbridge { | ||||
FILE *fopen(const fs::path &p, const char *mode) { | FILE *fopen(const fs::path &p, const char *mode) { | ||||
#ifndef WIN32 | |||||
return ::fopen(p.string().c_str(), mode); | 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 | #ifndef WIN32 | ||||
static std::string GetErrorReason() { | static std::string GetErrorReason() { | ||||
return std::strerror(errno); | return std::strerror(errno); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 214 Lines • Show Last 20 Lines |