1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-06 09:34:05 +00:00

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; color: #333;
@include S(margin-top, 15px); @include S(margin-top, 15px);
@include SuperSmallText; @include SuperSmallText;
text-align: center;
} }
.steamLink { .steamLink {

View File

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

View File

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