| 1081 | } |
| 1082 | |
| 1083 | bool FileMcd_RenameCard(const std::string_view name, const std::string_view new_name) |
| 1084 | { |
| 1085 | const std::string name_path(Path::Combine(EmuFolders::MemoryCards, name)); |
| 1086 | const std::string new_name_path(Path::Combine(EmuFolders::MemoryCards, new_name)); |
| 1087 | |
| 1088 | FILESYSTEM_STAT_DATA sd, new_sd; |
| 1089 | if (!FileSystem::StatFile(name_path.c_str(), &sd) || FileSystem::StatFile(new_name_path.c_str(), &new_sd)) |
| 1090 | { |
| 1091 | Console.Error("(FileMcd) New name already exists, or old name does not"); |
| 1092 | return false; |
| 1093 | } |
| 1094 | |
| 1095 | Console.WriteLn("(FileMcd) Renaming memory card '%.*s' to '%.*s'", |
| 1096 | static_cast<int>(name.size()), name.data(), |
| 1097 | static_cast<int>(new_name.size()), new_name.data()); |
| 1098 | |
| 1099 | if (!FileSystem::RenamePath(name_path.c_str(), new_name_path.c_str())) |
| 1100 | { |
| 1101 | Console.Error("(FileMcd) Failed to rename '%s' to '%s'", name_path.c_str(), new_name_path.c_str()); |
| 1102 | return false; |
| 1103 | } |
| 1104 | |
| 1105 | return true; |
| 1106 | } |
| 1107 | |
| 1108 | bool FileMcd_DeleteCard(const std::string_view name) |
| 1109 | { |