diff options
Diffstat (limited to 'config.cpp')
-rw-r--r-- | config.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -9,6 +9,7 @@ #include <exception> #include <iostream> +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<std::string>("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(); |