Merge pull request #13995 from Dentomologist/deletedirrecursively_dont_report_error_if_directory_is_absent

DeleteDirRecursively: Don't report error for absent directory
This commit is contained in:
JosJuice 2025-10-06 20:04:32 +02:00 committed by GitHub
commit 03ef9b4995
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -528,9 +528,9 @@ bool DeleteDirRecursively(const std::string& directory)
std::error_code 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)
ERROR_LOG_FMT(COMMON, "{}: {} failed {}", __func__, directory, error.message());
ERROR_LOG_FMT(COMMON, "{}: {} failed. {}", __func__, directory, error.message());
return success;
}