Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler flag in Windows #1042

Merged
merged 1 commit into from
Aug 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions libs/yocto/yocto_commonio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ file_stream::~file_stream() {

// Open a file
file_stream open_file(const string& filename, const string& mode) {
#ifdef _Win32
#ifdef _WIN32
auto path8 = std::filesystem::u8path(filename);
auto wmode = std::wstring(mode.begin(), mode.end());
auto fs = _wfopen(path.c_str(), wmode.c_str());
auto fs = _wfopen(path8.c_str(), wmode.c_str());
#else
auto fs = fopen(filename.c_str(), mode.c_str());
#endif
Expand Down Expand Up @@ -191,10 +191,10 @@ bool write_data(file_stream& fs, const void* buffer, size_t count) {

// Opens a file with a utf8 file name
FILE* fopen_utf8(const char* filename, const char* mode) {
#ifdef _Win32
#ifdef _WIN32
auto path8 = std::filesystem::u8path(filename);
auto wmode = std::wstring(string{mode}.begin(), string{mode}.end());
return _wfopen(path.c_str(), wmode.c_str());
return _wfopen(path8.c_str(), wmode.c_str());
#else
return fopen(filename, mode);
#endif
Expand Down