From df7146818d78c6bfbfcb8fcd7a4d8d1847d5a580 Mon Sep 17 00:00:00 2001 From: illusion0001 <37698908+illusion0001@users.noreply.github.com> Date: Sun, 23 Jul 2023 20:20:23 -0500 Subject: [PATCH] [Config] Print contents of loaded config file --- src/xenia/config.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/xenia/config.cc b/src/xenia/config.cc index 801f7ac8a..2bfa241cb 100644 --- a/src/xenia/config.cc +++ b/src/xenia/config.cc @@ -25,12 +25,22 @@ std::shared_ptr ParseFile( " could not be opened for parsing"); } // since cpptoml can't parse files with a UTF-8 BOM we need to skip them - char bom[3]; + char bom[3]{}; file.read(bom, sizeof(bom)); if (file.fail() || bom[0] != '\xEF' || bom[1] != '\xBB' || bom[2] != '\xBF') { file.clear(); file.seekg(0); } + if (xe::utf8::ends_with(filename.string(), ".config.toml")) { + std::string config_content{}; + std::string config_line{}; + // dump contents of loaded config file + // content is expected to be utf8 + while (std::getline(file, config_line)) { + config_content.append(fmt::format("{}\n", config_line)); + } + XELOGI("Loading config: {}\n{}", xe::path_to_utf8(filename), config_content); + } cpptoml::parser p(file); return p.parse();