Closed claudeha closed 1 year ago
This patch makes it compile with mingw g++ 10. Seems hacky though.
diff --git a/include/toml++/impl/parser.inl b/include/toml++/impl/parser.inl
index 7aa9afb..f780cd8 100644
--- a/include/toml++/impl/parser.inl
+++ b/include/toml++/impl/parser.inl
@@ -3763,7 +3763,7 @@ TOML_ANON_NAMESPACE_START
TOML_OVERALIGNED char file_buffer[sizeof(void*) * 1024u];
file.rdbuf()->pubsetbuf(file_buffer, sizeof(file_buffer));
#if TOML_WINDOWS
- file.open(impl::widen(file_path_str), std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
+ file.open(impl::widen(file_path_str).c_str(), std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
#else
file.open(file_path_str, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
#endif
diff --git a/toml.hpp b/toml.hpp
index 5e4c7f8..7f48c7d 100644
--- a/toml.hpp
+++ b/toml.hpp
@@ -15772,7 +15772,7 @@ TOML_ANON_NAMESPACE_START
TOML_OVERALIGNED char file_buffer[sizeof(void*) * 1024u];
file.rdbuf()->pubsetbuf(file_buffer, sizeof(file_buffer));
#if TOML_WINDOWS
- file.open(impl::widen(file_path_str), std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
+ file.open(impl::widen(file_path_str).c_str(), std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
#else
file.open(file_path_str, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
#endif
Hah, yeah, that's a bit clunky but perfectly safe. I'll gladly accept that in a PR if you mind putting it in one
Running Debian testing (to be released as Bookworm):
With this test program:
I get this error message:
Error message goes away if I revert cc741c9f5f2a62856a2a2e9e275f61eb0591c09c, but the commit messages says it fixes non-ASCII paths on Windows so it's probably not a good solution.