summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FileUtil.cpp
diff options
context:
space:
mode:
authorDentomologist <dentomologist@gmail.com>2020-12-03 13:07:17 -0800
committerDentomologist <dentomologist@gmail.com>2020-12-03 13:31:53 -0800
commitc434eefe94c73978605cf4dfe1459d2f8ede0858 (patch)
tree9aa345b2daeb7df3574962e9f39607a3809a1305 /Source/Core/Common/FileUtil.cpp
parenta34823df61df65168aa40ef5e82e44defd4a0138 (diff)
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.
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
-rw-r--r--Source/Core/Common/FileUtil.cpp7
1 files changed, 7 insertions, 0 deletions
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))
{