Skip to content

Commit

Permalink
Googletest export
Browse files Browse the repository at this point in the history
Addresses google#2848 by using `_wfopen(...)` on Windows

PiperOrigin-RevId: 312198825
  • Loading branch information
Abseil Team authored and derekmauro committed May 28, 2020
1 parent a0669e0 commit f3a5961
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions googletest/include/gtest/internal/gtest-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@
#endif

#include <iostream> // NOLINT
#include <locale>
#include <memory>
#include <string> // NOLINT
#include <tuple>
Expand Down Expand Up @@ -2045,7 +2046,14 @@ GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
inline int ChDir(const char* dir) { return chdir(dir); }
#endif
inline FILE* FOpen(const char* path, const char* mode) {
#if GTEST_OS_WINDOWS
std::wstring_convert<std::codecvt<wchar_t, char, std::mbstate_t>> converter;
std::wstring wide_path = converter.from_bytes(path);
std::wstring wide_mode = converter.from_bytes(mode);
return _wfopen(wide_path.c_str(), wide_mode.c_str());
#else
return fopen(path, mode);
#endif // GTEST_OS_WINDOWS
}
#if !GTEST_OS_WINDOWS_MOBILE
inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
Expand Down

0 comments on commit f3a5961

Please sign in to comment.