summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-05 19:47:05 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-05 19:47:05 +0100
commite8a7c88b6cedbd05b183e85dff74c513bfcd774e (patch)
tree5d0fe8c8b387ca4846b0ec76a4955aa92c363f21 /config.cpp
parentd2690b7c3639cc1555b34d002de782976cbb6845 (diff)
Test config.cpp
Diffstat (limited to 'config.cpp')
-rw-r--r--config.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/config.cpp b/config.cpp
index b892317..342d973 100644
--- a/config.cpp
+++ b/config.cpp
@@ -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();