Fix being unable to delete savegames when it was deleted before, minor adjustments

This commit is contained in:
tobspr 2022-06-20 11:17:33 +02:00
parent 690483fd89
commit 7797546ed4
3 changed files with 16 additions and 9 deletions

View File

@ -148,6 +148,7 @@
color: #333;
@include S(margin-top, 15px);
@include SuperSmallText;
text-align: center;
}
.steamLink {

View File

@ -5,6 +5,7 @@ export const CHANGELOG = [
entries: [
"Reworked the tutorial to be simpler and more interactive",
"General polishing",
"Fix being unable to delete savegame when the savegame file was deleted externally",
"Updated translations",
],
},

View File

@ -99,17 +99,22 @@ export class SavegameManager extends ReadWriteProxy {
metaDataRef: game,
});
return handle.deleteAsync().then(() => {
for (let i = 0; i < this.currentData.savegames.length; ++i) {
const potentialGame = this.currentData.savegames[i];
if (potentialGame.internalId === handle.internalId) {
this.currentData.savegames.splice(i, 1);
break;
return handle
.deleteAsync()
.catch(err => {
console.warn("Failed to unlink physical savegame file, still removing:", err);
})
.then(() => {
for (let i = 0; i < this.currentData.savegames.length; ++i) {
const potentialGame = this.currentData.savegames[i];
if (potentialGame.internalId === handle.internalId) {
this.currentData.savegames.splice(i, 1);
break;
}
}
}
return this.writeAsync();
});
return this.writeAsync();
});
}
/**