MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / FioRemove

Function FioRemove

src/fileio.cpp:327–340  ·  view source on GitHub ↗

* Remove a file. * @param filename Filename to remove. * @return true iff the file was removed. */

Source from the content-addressed store, hash-verified

325 * @return true iff the file was removed.
326 */
327bool 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.

Callers 5

SelectDriverImplMethod · 0.85
ConRemoveFunction · 0.85
AfterDownloadMethod · 0.85

Calls 2

messageMethod · 0.80
OTTD2FSFunction · 0.70

Tested by

no test coverage detected