Skip to content

Commit

Permalink
peeve: guarantee toml order (wheremyfoodat#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
yretenai authored Mar 8, 2024
1 parent 498d19f commit ff1eaed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <cmath>
#include <fstream>
#include <map>
#include <string>

#include "helpers.hpp"
Expand Down Expand Up @@ -99,13 +100,13 @@ void EmulatorConfig::load() {
}

void EmulatorConfig::save() {
toml::basic_value<toml::preserve_comments> data;
toml::basic_value<toml::preserve_comments, std::map> data;
const std::filesystem::path& path = filePath;

std::error_code error;
if (std::filesystem::exists(path, error)) {
try {
data = toml::parse<toml::preserve_comments>(path);
data = toml::parse<toml::preserve_comments, std::map>(path);
} catch (const std::exception& ex) {
Helpers::warn("Exception trying to parse config file. Exception: %s\n", ex.what());
return;
Expand Down

0 comments on commit ff1eaed

Please sign in to comment.