From 26fef5b62b0ed492fa40323861f4ad2b5ce31116 Mon Sep 17 00:00:00 2001 From: Kuhnovic <68320206+Kuhnovic@users.noreply.github.com> Date: Mon, 15 Sep 2025 21:17:18 +0200 Subject: [PATCH] Fix 4eaeccd: FioRemove should return false if the file does not exist. (#14619) --- src/fileio.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fileio.cpp b/src/fileio.cpp index bae969a362..981d37c8cd 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -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;