From d0ccf32d4460c42d487630504ad56dd76eef4450 Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Fri, 12 Apr 2024 17:17:45 -0400 Subject: [PATCH] Fix logic error in FileUtilities::ValidateDirectoryWritePermission Signed-off-by: Michael Jackson --- src/simplnx/Utilities/FileUtilities.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/simplnx/Utilities/FileUtilities.cpp b/src/simplnx/Utilities/FileUtilities.cpp index b361455b6b..5ce3264c78 100644 --- a/src/simplnx/Utilities/FileUtilities.cpp +++ b/src/simplnx/Utilities/FileUtilities.cpp @@ -172,9 +172,10 @@ Result<> ValidateDirectoryWritePermission(const fs::path& path, bool isFile) } auto checkedPath = path; - if(isFile) + auto parentPath = checkedPath.parent_path(); + if(isFile && !parentPath.empty()) { - checkedPath = checkedPath.parent_path(); + checkedPath = parentPath; } // We now have the parent directory. Let us see if *any* part of the path exists