make sure that the file we are attempting to parse actually exists

before that case was identical to an empty data file...
This commit is contained in:
Andreas Lauser
2014-04-15 13:49:47 +02:00
parent 6a1b887323
commit 0ca3a30697

View File

@@ -44,7 +44,17 @@ namespace Opm {
dataFile = inputDataFile;
deck = deckToFill;
rootPath = commonRootPath;
inputstream.reset(new std::ifstream(inputDataFile.string().c_str()));
std::ifstream *ifs = new std::ifstream(inputDataFile.string().c_str());
inputstream.reset(ifs);
// make sure the file we'd like to parse exists and is
// readable
if (!ifs->is_open()) {
throw std::runtime_error(std::string("Input file '") +
inputDataFile.string() +
std::string("' does not exist or is not readable"));
}
}
ParserState(const std::string &inputData, DeckPtr deckToFill, bool useStrictParsing) {