From ee89213a57cd5f4a4d9e01be0ad0615bda95f64e Mon Sep 17 00:00:00 2001 From: modeco80 Date: Wed, 15 Jan 2025 19:37:01 -0500 Subject: [PATCH] tools/eupak: Add check for if user provides a valid directory path Oops. --- src/tools/eupak/tasks/InfoTask.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tools/eupak/tasks/InfoTask.cpp b/src/tools/eupak/tasks/InfoTask.cpp index d65e5b3..65f253d 100644 --- a/src/tools/eupak/tasks/InfoTask.cpp +++ b/src/tools/eupak/tasks/InfoTask.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -50,6 +51,12 @@ namespace eupak::tasks { try { args.verbose = parser.get("--verbose"); args.inputPath = eupak::fs::path(parser.get("input")); + + if(fs::is_directory(args.inputPath)) { + std::cout << "Error: " << args.inputPath << " appears to be a directory, not a file.\n"; + return 1; + } + } catch(...) { return 1; } @@ -63,6 +70,7 @@ namespace eupak::tasks { int InfoTask::Run() { const auto& args = currentArgs; + std::ifstream ifs(args.inputPath.string(), std::ifstream::binary); if(!ifs) {