fixed toml::parse_file() on windows for non-ASCII paths

see: https://github.com/PrismLauncher/PrismLauncher/issues/226
This commit is contained in:
Mark Gillard 2022-11-05 16:21:48 +02:00
parent 1e4a3833d0
commit cc741c9f5f
4 changed files with 13 additions and 4 deletions

View File

@ -28,6 +28,7 @@ template:
- fixed null pointer dereference in parser when exceptions are disabled (#169) (@ncaklovic)
- fixed spurious warnings in MSVC 19.34
- fixed some `_Float16` detection issues
- fixed `toml::parse_file()` on windows for non-ASCII paths
<br><br>

View File

@ -3762,7 +3762,11 @@ TOML_ANON_NAMESPACE_START
std::ifstream file;
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);
#else
file.open(file_path_str, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
#endif
if (!file.is_open())
TOML_PARSE_FILE_ERROR("File could not be opened for reading", file_path_str);

View File

@ -11,7 +11,7 @@
#endif
//# }}
#if TOML_ENABLE_WINDOWS_COMPAT
#if TOML_WINDOWS
#include "std_string.h"
#ifndef _WINDOWS_
#if TOML_INCLUDE_WINDOWS_H
@ -96,4 +96,4 @@ TOML_IMPL_NAMESPACE_START
TOML_IMPL_NAMESPACE_END;
#include "header_end.h"
#endif // TOML_ENABLE_WINDOWS_COMPAT
#endif // TOML_WINDOWS

View File

@ -9690,7 +9690,7 @@ TOML_POP_WARNINGS;
//******** impl/std_string.inl ***************************************************************************************
#if TOML_ENABLE_WINDOWS_COMPAT
#if TOML_WINDOWS
#ifndef _WINDOWS_
#if TOML_INCLUDE_WINDOWS_H
@ -9789,7 +9789,7 @@ TOML_IMPL_NAMESPACE_END;
#endif
TOML_POP_WARNINGS;
#endif // TOML_ENABLE_WINDOWS_COMPAT
#endif // TOML_WINDOWS
//******** impl/print_to_stream.inl **********************************************************************************
@ -15730,7 +15730,11 @@ TOML_ANON_NAMESPACE_START
std::ifstream file;
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);
#else
file.open(file_path_str, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
#endif
if (!file.is_open())
TOML_PARSE_FILE_ERROR("File could not be opened for reading", file_path_str);