diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-19 00:55:33 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-02-19 00:55:33 +0100 |
commit | 28f09ed1ed8d3defef1497f1f9c0f141e66bb812 (patch) | |
tree | 17ec1770fbca5cbd61b350650d34b36a5e1ea5a4 /src/cli | |
parent | 0b4a9d877069ac488f409bec4f526686422dff69 (diff) |
Nice error messages in case the input file does not exist or is not a file
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/Main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cli/Main.cpp b/src/cli/Main.cpp index 88ec6b9..d03735d 100644 --- a/src/cli/Main.cpp +++ b/src/cli/Main.cpp @@ -171,6 +171,14 @@ int main(int argc, char **argv) logger.error("Currently no reading from std::in is supported!"); return ERROR_IN_COMMAND_LINE; } else { + if (!fs::exists(inputPath)) { + logger.error("Input file \"" + inputPath + "\" does not exist"); + return ERROR_IN_COMMAND_LINE; + } + if (!fs::is_regular_file(inputPath)) { + logger.error("Input file \"" + inputPath + "\" is not a regular file"); + return ERROR_IN_COMMAND_LINE; + } inputPath = fs::canonical(inputPath).string(); } |