Savestate browser: delete the screenshot and name file along with the state

Deleting a savestate from the savedata screen goes through GameInfo::Delete,
not SaveState::DeleteSlot, and it only knew about the .jpg - so the slot's
.name.txt was left behind with nothing to belong to.

Rather than teach the UI the naming scheme a third time, SaveState now answers
what sits beside a state.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5 committed 2026-09-12 13:58:20 -06:00
1 parent 55f53d4523
commit 6600d1c05f
3 files changed
+26 -3

No files matched your search

+5 -3
View File
@@ -170,9 +170,11 @@ bool GameInfo::Delete() {
const Path &ppstPath = filePath_;
INFO_LOG(Log::System, "Deleting file %s", ppstPath.c_str());
MoveFileToTrashOrDelete(ppstPath);
Path screenshotPath;
if (filePath_.WithReplacedExtension(".ppst", ".jpg", &screenshotPath) && File::Exists(screenshotPath)) {
MoveFileToTrashOrDelete(screenshotPath);
// The screenshot and the slot's custom name are no use without the state itself.
for (const Path &companion : SaveState::GetCompanionFilePaths(ppstPath)) {
if (File::Exists(companion)) {
MoveFileToTrashOrDelete(companion);
}
}
return true;
}