toml::Wrapper removed

This commit is contained in:
MihailRis
2024-04-28 17:23:52 +03:00
parent 184ecd88ba
commit c3b5576c02
22 changed files with 795 additions and 965 deletions
+5 -6
View File
@@ -9,7 +9,7 @@
#include "engine.h"
#include "coders/toml.h"
#include "files/files.h"
#include "files/settings_io.h"
#include "files/settings_io.hpp"
#include "files/engine_paths.h"
#include "util/platform.h"
#include "util/command_line.h"
@@ -33,18 +33,17 @@ int main(int argc, char** argv) {
fs::path userfiles = paths.getUserfiles();
try {
EngineSettings settings;
std::unique_ptr<toml::Wrapper> wrapper (create_wrapper(settings));
SettingsHandler handler(settings);
fs::path settings_file = userfiles/fs::path(SETTINGS_FILE);
fs::path controls_file = userfiles/fs::path(CONTROLS_FILE);
if (fs::is_regular_file(settings_file)) {
logger.info() << "loading settings";
std::string text = files::read_string(settings_file);
toml::Reader reader(wrapper.get(), settings_file.string(), text);
reader.read();
toml::parse(handler, settings_file.string(), text);
}
corecontent::setup_bindings();
Engine engine(settings, &paths);
Engine engine(settings, handler, &paths);
if (fs::is_regular_file(controls_file)) {
logger.info() << "loading controls";
std::string text = files::read_string(controls_file);
@@ -53,7 +52,7 @@ int main(int argc, char** argv) {
engine.mainloop();
logger.info() << "saving settings";
files::write_string(settings_file, wrapper->write());
files::write_string(settings_file, toml::stringify(handler));
files::write_string(controls_file, write_controls());
}
catch (const initialize_error& err) {