From 28f09ed1ed8d3defef1497f1f9c0f141e66bb812 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Thu, 19 Feb 2015 00:55:33 +0100 Subject: Nice error messages in case the input file does not exist or is not a file --- src/cli/Main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/cli') 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(); } -- cgit v1.2.3