| 535 | } |
| 536 | |
| 537 | static bool ConRemove(std::span<std::string_view> argv) |
| 538 | { |
| 539 | if (argv.empty()) { |
| 540 | IConsolePrint(CC_HELP, "Remove a savegame by name or index. Usage: 'rm <file | number>'."); |
| 541 | return true; |
| 542 | } |
| 543 | |
| 544 | if (argv.size() != 2) return false; |
| 545 | |
| 546 | std::string_view file = argv[1]; |
| 547 | _console_file_list_savegame.ValidateFileList(); |
| 548 | const FiosItem *item = _console_file_list_savegame.FindItem(file); |
| 549 | if (item != nullptr) { |
| 550 | if (item->type.abstract == FT_SAVEGAME) { |
| 551 | if (!FioRemove(item->name)) { |
| 552 | IConsolePrint(CC_ERROR, "Failed to delete '{}'.", item->name); |
| 553 | } |
| 554 | } else { |
| 555 | IConsolePrint(CC_ERROR, "'{}' is not a savegame.", file); |
| 556 | } |
| 557 | } else { |
| 558 | IConsolePrint(CC_ERROR, "'{}' could not be found.", file); |
| 559 | } |
| 560 | |
| 561 | _console_file_list_savegame.InvalidateFileList(); |
| 562 | return true; |
| 563 | } |
| 564 | |
| 565 | |
| 566 | /* List all the files in the current dir via console */ |
nothing calls this directly
no test coverage detected