config: Keep in order (#2536)
Some checks are pending
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / reuse (push) Waiting to run
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

This commit is contained in:
Osyotr 2025-02-25 21:46:35 +03:00 committed by GitHub
parent be6840f6a9
commit f0cc8c0d54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -834,7 +834,7 @@ void load(const std::filesystem::path& path) {
}
void save(const std::filesystem::path& path) {
toml::value data;
toml::ordered_value data;
std::error_code error;
if (std::filesystem::exists(path, error)) {
@ -842,7 +842,8 @@ void save(const std::filesystem::path& path) {
std::ifstream ifs;
ifs.exceptions(std::ifstream::failbit | std::ifstream::badbit);
ifs.open(path, std::ios_base::binary);
data = toml::parse(ifs, std::string{fmt::UTF(path.filename().u8string()).data});
data = toml::parse<toml::ordered_type_config>(
ifs, std::string{fmt::UTF(path.filename().u8string()).data});
} catch (const std::exception& ex) {
fmt::print("Exception trying to parse config file. Exception: {}\n", ex.what());
return;
@ -924,7 +925,7 @@ void save(const std::filesystem::path& path) {
}
void saveMainWindow(const std::filesystem::path& path) {
toml::value data;
toml::ordered_value data;
std::error_code error;
if (std::filesystem::exists(path, error)) {
@ -932,7 +933,8 @@ void saveMainWindow(const std::filesystem::path& path) {
std::ifstream ifs;
ifs.exceptions(std::ifstream::failbit | std::ifstream::badbit);
ifs.open(path, std::ios_base::binary);
data = toml::parse(ifs, std::string{fmt::UTF(path.filename().u8string()).data});
data = toml::parse<toml::ordered_type_config>(
ifs, std::string{fmt::UTF(path.filename().u8string()).data});
} catch (const std::exception& ex) {
fmt::print("Exception trying to parse config file. Exception: {}\n", ex.what());
return;