mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-10-24 08:59:15 +00:00
DeleteDirRecursively: Don't report error for absent directory
Check if the return value of std::filesystem::remove_all is -1 rather than 0; the former is the specified return value if there's an error while 0 just means the directory already didn't exist (which is the end result we want). Previously error messages such as the following were possible: E[COMMON]: DeleteDirRecursively: [path]/User/RedirectSession/ failed The operation completed successfully. Also adds a period in the error string to make it look nicer.
This commit is contained in:
parent
9c97498f4b
commit
f64e57442c
1 changed files with 2 additions and 2 deletions
|
|
@ -528,9 +528,9 @@ bool DeleteDirRecursively(const std::string& directory)
|
||||||
|
|
||||||
std::error_code error;
|
std::error_code error;
|
||||||
const std::uintmax_t num_removed = std::filesystem::remove_all(StringToPath(directory), error);
|
const std::uintmax_t num_removed = std::filesystem::remove_all(StringToPath(directory), error);
|
||||||
const bool success = num_removed != 0 && !error;
|
const bool success = num_removed != static_cast<std::uintmax_t>(-1) && !error;
|
||||||
if (!success)
|
if (!success)
|
||||||
ERROR_LOG_FMT(COMMON, "{}: {} failed {}", __func__, directory, error.message());
|
ERROR_LOG_FMT(COMMON, "{}: {} failed. {}", __func__, directory, error.message());
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue