MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / FileMcd_RenameCard

Function FileMcd_RenameCard

pcsx2/SIO/Memcard/MemoryCardFile.cpp:1083–1106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1081}
1082
1083bool 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
1108bool FileMcd_DeleteCard(const std::string_view name)
1109{

Callers 1

renameCardMethod · 0.85

Calls 6

CombineFunction · 0.85
c_strMethod · 0.45
ErrorMethod · 0.45
WriteLnMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected