From 219471be0b9c10c6156badc9ce489b211a6168af Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Wed, 20 Mar 2024 10:01:58 -0400 Subject: [PATCH] BUG: Return invalid Result<> if size of directory is requested. (#891) Signed-off-by: Michael Jackson --- src/simplnx/Utilities/FileUtilities.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/simplnx/Utilities/FileUtilities.cpp b/src/simplnx/Utilities/FileUtilities.cpp index ebb978af8a..4161956ce5 100644 --- a/src/simplnx/Utilities/FileUtilities.cpp +++ b/src/simplnx/Utilities/FileUtilities.cpp @@ -65,7 +65,11 @@ Result<> ValidateCSVFile(const std::string& filePath) if(!fs::exists({absPath})) { - return MakeErrorResult(-300, fmt::format("File does not exist: {}", absPath.string())); + return MakeErrorResult(-300, fmt::format("CSV file does not exist: {}", absPath.string())); + } + if(fs::is_directory({absPath})) + { + return MakeErrorResult(-301, fmt::format("CSV input file is a directory: {}", absPath.string())); } // Obtain the file size