Browse Source

check file goodness

Patrick Brosi 6 years ago
parent
commit
21f0bc9c25
1 changed files with 5 additions and 0 deletions
  1. 5 0
      ConfigFileParser.cpp

+ 5 - 0
ConfigFileParser.cpp

@@ -22,6 +22,11 @@ void ConfigFileParser::parse(const std::string& path) {
22
   KeyVals curKV;
22
   KeyVals curKV;
23
   std::string tmp, tmp2;
23
   std::string tmp, tmp2;
24
   std::ifstream is(path);
24
   std::ifstream is(path);
25
+
26
+  if (!is.good()) {
27
+    throw ParseExc(0, 0, "valid file", "file I could not open", path);
28
+  }
29
+
25
   char c;
30
   char c;
26
   size_t l = 1, pos = 0, valLine = 0, valPos = 0;
31
   size_t l = 1, pos = 0, valLine = 0, valPos = 0;
27
 
32