From e8a7c88b6cedbd05b183e85dff74c513bfcd774e Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Thu, 5 Jan 2023 19:47:05 +0100 Subject: Test config.cpp --- config.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'config.cpp') diff --git a/config.cpp b/config.cpp index b892317..342d973 100644 --- a/config.cpp +++ b/config.cpp @@ -9,6 +9,7 @@ #include #include +namespace fs = std::filesystem; namespace pt = boost::property_tree; using namespace std::string_literals; @@ -26,15 +27,16 @@ namespace { } // anonymous namespace -void Config::readConfigfile(std::string filename) +void Config::readConfigfile(const std::filesystem::path& filename) { - if (filename == "") { - filename = default_filename; + fs::path used_filename{filename}; + if (used_filename.empty()) { + used_filename = default_filename; } pt::ptree tree; - pt::read_xml(filename, tree, pt::xml_parser::no_comments | pt::xml_parser::trim_whitespace); + pt::read_xml(used_filename, tree, pt::xml_parser::no_comments | pt::xml_parser::trim_whitespace); // mandatory m_user = tree.get("webserver.user"); @@ -203,7 +205,7 @@ void Config::create_look_up_table() } } -Config::Config(const std::string& filename) +Config::Config(const std::filesystem::path& filename) { readConfigfile(filename); dump(); -- cgit v1.2.3