1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-27 06:04:25 +01:00

Fix 4eaeccd: FioRemove should return false if the file does not exist. (#14619)

This commit is contained in:
Kuhnovic
2025-09-15 21:17:18 +02:00
committed by GitHub
parent f2f6609206
commit 26fef5b62b

View File

@@ -328,9 +328,12 @@ bool FioRemove(const std::string &filename)
{
std::filesystem::path path = OTTD2FS(filename);
std::error_code error_code;
std::filesystem::remove(path, error_code);
if (error_code) {
Debug(misc, 0, "Removing {} failed: {}", filename, error_code.message());
if (!std::filesystem::remove(path, error_code)) {
if (error_code) {
Debug(misc, 0, "Removing {} failed: {}", filename, error_code.message());
} else {
Debug(misc, 0, "Removing {} failed: file does not exist", filename);
}
return false;
}
return true;