Closed Raildex closed 1 year ago
Ah, I see. I suspect this has something to do with read-mode, since TOML is UTF-8 and newline-agnostic. Can you try opening the std::ifstream
with the std::ios::binary
flag?
As an aside, from memory, these lines:
s.graphics.fog = (settings_quality)graphics["fog"].value_or<int>(int(settings_quality::medium));
can probably just be:
s.graphics.fog = graphics["fog"].value_or<settings_quality>(settings_quality::medium);
i.e. it should accept an enum directly - if it doesn't let me know! (I'm not 100% sure, it's been a while since I worked on that part of the library)
@marzer whether I use ios::binary or not doesn't make a difference.
Interesting, alright well I guess I'll dig into this and see what's up.
I've double checked now: It works on binary mode but not on text mode. My own stream class was broken and I did not notice it until now.
Ah, good news. I'll close this out, then, since I wasn't able to reproduce this locally.
settings.toml.txt
Environment
toml v 3.3.0
Compiler:
Visual Studio 2022
C++ standard mode:
c++latest
Target arch:
x64
Describe the bug
File that was generated with toml++ results in an error when trying to parse it.
Steps to reproduce (or a small repro code sample)
The function
deserialize_settings
reads and throws an error (see comment "error here")