Skip to content

Commit

Permalink
fix #365
Browse files Browse the repository at this point in the history
use wide strings with msys, since its windows and working without wstrings fails in some tests cases
  • Loading branch information
Totto16 committed Aug 11, 2024
1 parent 7bc188e commit 7af83c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions include/tao/pegtl/internal/read_file_stdio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/test/pegtl/verify_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 7af83c8

Please sign in to comment.