diff --git a/include/tao/pegtl/internal/read_file_stdio.hpp b/include/tao/pegtl/internal/read_file_stdio.hpp index 2d50c4798..29210cf1d 100644 --- a/include/tao/pegtl/internal/read_file_stdio.hpp +++ b/include/tao/pegtl/internal/read_file_stdio.hpp @@ -24,7 +24,7 @@ namespace TAO_PEGTL_NAMESPACE::internal [[nodiscard]] inline std::FILE* read_file_open( const std::filesystem::path& path ) { errno = 0; -#if defined( _MSC_VER ) +#if defined( _MSC_VER ) || defined( __MINGW32__ ) std::FILE* file; if( ::_wfopen_s( &file, path.c_str(), L"rb" ) == 0 ) { return file; @@ -37,12 +37,7 @@ namespace TAO_PEGTL_NAMESPACE::internal std::terminate(); #endif #else -#if defined( __MINGW32__ ) - if( auto* file = std::fopen( path.string().c_str(), "rb" ) ) -#else - if( auto* file = std::fopen( path.c_str(), "rbe" ) ) -#endif - { + if( auto* file = std::fopen( path.c_str(), "rbe" ) ) { return file; } #if defined( __cpp_exceptions ) diff --git a/src/test/pegtl/verify_file.hpp b/src/test/pegtl/verify_file.hpp index 7f6aee32c..bddf8b220 100644 --- a/src/test/pegtl/verify_file.hpp +++ b/src/test/pegtl/verify_file.hpp @@ -9,7 +9,7 @@ #include "test.hpp" -#if defined( _MSC_VER ) +#if defined( _MSC_VER ) || defined( __MINGW32__ ) #define TAO_PEGTL_TEST_FILENAME u"src/test/pegtl/file_äöü𝄞_data.txt" #else #define TAO_PEGTL_TEST_FILENAME "src/test/pegtl/file_äöü𝄞_data.txt"