From c434eefe94c73978605cf4dfe1459d2f8ede0858 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Thu, 3 Dec 2020 13:07:17 -0800 Subject: [PATCH] Change File::DeleteDir return value Makes File::DeleteDir return true when attempting to delete a nonexistent path. The purpose of DeleteDir is to ensure the path doesn't exist after the call, which is better reflected by the new return value. Additionally, none of the current callers actually check the return value so this won't break any existing code. --- Source/Core/Common/FileUtil.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 5e8868da21..6039a449fa 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -257,6 +257,13 @@ bool DeleteDir(const std::string& filename) { INFO_LOG_FMT(COMMON, "DeleteDir: directory {}", filename); + // Return true because we care about the directory not being there, not the actual delete. + if (!File::Exists(filename)) + { + WARN_LOG_FMT(COMMON, "DeleteDir: {} does not exist", filename); + return true; + } + // check if a directory if (!IsDirectory(filename)) {