attempt at correct utf8 decoding for toml config file path

This commit is contained in:
RSDuck 2024-07-30 17:48:41 +02:00
parent 01c2d65f07
commit b778fbaad1

View File

@ -22,6 +22,7 @@
#include <inttypes.h> #include <inttypes.h>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <filesystem>
#include <regex> #include <regex>
#include "toml/toml.hpp" #include "toml/toml.hpp"
@ -741,7 +742,7 @@ bool Load()
try try
{ {
RootTable = toml::parse(cfgpath); RootTable = toml::parse(std::filesystem::u8path(cfgpath));
} }
catch (toml::syntax_error& err) catch (toml::syntax_error& err)
{ {
@ -758,7 +759,7 @@ void Save()
return; return;
std::ofstream file; std::ofstream file;
file.open(cfgpath, std::ofstream::out | std::ofstream::trunc); file.open(std::filesystem::u8path(cfgpath), std::ofstream::out | std::ofstream::trunc);
file << RootTable; file << RootTable;
file.close(); file.close();
} }