* Remove a file. * @param filename Filename to remove. * @return true iff the file was removed. */
| 325 | * @return true iff the file was removed. |
| 326 | */ |
| 327 | bool FioRemove(const std::string &filename) |
| 328 | { |
| 329 | std::filesystem::path path = OTTD2FS(filename); |
| 330 | std::error_code error_code; |
| 331 | if (!std::filesystem::remove(path, error_code)) { |
| 332 | if (error_code) { |
| 333 | Debug(misc, 0, "Removing {} failed: {}", filename, error_code.message()); |
| 334 | } else { |
| 335 | Debug(misc, 0, "Removing {} failed: file does not exist", filename); |
| 336 | } |
| 337 | return false; |
| 338 | } |
| 339 | return true; |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * Appends, if necessary, the path separator character to the end of the string. |
no test coverage detected