Codechange: Introduce FioRemove() to remove files. (#12491)

New function FioRemove() handles OTTD2FS conversion, and uses std::filesystem::remove instead of unlink, all in one location.
This commit is contained in:
Peter Nelson
2024-04-14 23:43:50 +01:00
committed by GitHub
parent 29e932e087
commit 4eaeccdaeb
7 changed files with 25 additions and 14 deletions

View File

@@ -523,7 +523,7 @@ DEF_CONSOLE_CMD(ConRemove)
_console_file_list_savegame.ValidateFileList();
const FiosItem *item = _console_file_list_savegame.FindItem(file);
if (item != nullptr) {
if (unlink(item->name.c_str()) != 0) {
if (!FioRemove(item->name)) {
IConsolePrint(CC_ERROR, "Failed to delete '{}'.", item->name);
}
} else {