canonicalize root paths
Stefan Schuermans

Stefan Schuermans commited on 2020-08-23 10:41:16
Showing 2 changed files, with 9 additions and 2 deletions.

... ...
@@ -29,7 +29,7 @@ void Config::parseFile(std::string const &configFileName) {
29 29
     if (typeStr == "#") {
30 30
       continue; // comment line -> ignore
31 31
     }
32
-    // actual consfiguration lines
32
+    // actual configuration lines
33 33
     if (typeStr == "tree") {
34 34
       Tree tree;
35 35
       tree.parseParams(line.substr(pos));
... ...
@@ -53,7 +53,14 @@ void Tree::parseParams(std::string const &paramStr) {
53 53
     throw std::runtime_error(msg.str());
54 54
   }
55 55
 
56
-  root = rootStr;
56
+  try {
57
+    root = boost::filesystem::canonical(rootStr);
58
+  } catch (std::exception const & e) {
59
+    std::stringstream msg;
60
+    msg << "invalid <root> field \"" << rootStr << "\" in \""
61
+        << paramStr << "\": " << e.what();
62
+    throw std::runtime_error(msg.str());
63
+  }
57 64
 }
58 65
 
59 66
 User const & Tree::getUser() const {
60 67