From 7f2e133f6390956dd64e294bfa6ee1cf7b7a1828 Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Tue, 10 Dec 2024 17:23:48 +0100 Subject: [PATCH] Warn if property string could potentially be a non-existing property file --- src/storm-parsers/api/properties.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/storm-parsers/api/properties.cpp b/src/storm-parsers/api/properties.cpp index b5f779753..9ff95701c 100644 --- a/src/storm-parsers/api/properties.cpp +++ b/src/storm-parsers/api/properties.cpp @@ -32,6 +32,12 @@ std::vector parseProperties(storm::parser::FormulaParser& STORM_LOG_INFO("Loading properties from file: " << inputString << '\n'); properties = formulaParser.parseFromFile(inputString); } else { + // File does not exists -> parse as property string + // Provide warning if string could potentially be a property file + if (inputString.find(".prop") != std::string::npos || inputString.find(".pctl") != std::string::npos || + inputString.find(".prctl") != std::string::npos || inputString.find(".csl") != std::string::npos) { + STORM_LOG_WARN("File with name '" << inputString << "' does not exist. Trying to parse as property string."); + } properties = formulaParser.parseFromString(inputString); } @@ -46,8 +52,7 @@ std::vector parseProperties(std::string const& inputStrin } catch (storm::exceptions::WrongFormatException const& e) { STORM_LOG_THROW(false, storm::exceptions::WrongFormatException, e.what() << "Note that the used API function does not have access to model variables. If the property you tried to parse contains " - "model variables, it will not " - "be parsed correctly."); + "model variables, it will not be parsed correctly."); } }