Skip to content

Commit 676c509

Browse files
authored
fix wipedebug console command not doing anything (#980)
1 parent fd05ec3 commit 676c509

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Celeste.Mod.mm/Patches/SaveData.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,17 @@ public static void LoadModSaveData(int slot) {
300300
public static new bool TryDelete(int slot) {
301301
bool vanillaExists = false;
302302
string saveFilePath = patch_UserIO.GetSaveFilePath();
303+
string saveFileName = GetFilename(slot);
303304
if (Directory.Exists(saveFilePath))
304-
vanillaExists = File.Exists(Path.Combine(saveFilePath, $"{slot}.celeste"));
305+
vanillaExists = File.Exists(Path.Combine(saveFilePath, $"{saveFileName}.celeste"));
305306

306307
if (vanillaExists) {
307308
if (!orig_TryDelete(slot)) {
308309
return false;
309310
}
310311
}
311312
else
312-
Logger.Warn("SaveData", $"Deleting save data for slot {slot} which has no vanilla data");
313+
Logger.Warn("SaveData", $"Deleting save data for slot {saveFileName} which has no vanilla data");
313314

314315
return TryDeleteModSaveData(slot);
315316
}
@@ -329,24 +330,25 @@ public static bool TryDeleteModSaveData(int slot) {
329330

330331
// clean modsave and modsession files which are not deleted if their module is not loaded
331332
string saveFilePath = patch_UserIO.GetSaveFilePath();
333+
string saveFileName = GetFilename(slot);
332334
if (Directory.Exists(saveFilePath)) {
333-
foreach (string modSaveFile in Directory.GetFiles(saveFilePath, $"{slot}-modsave-*.celeste")) {
335+
foreach (string modSaveFile in Directory.GetFiles(saveFilePath, $"{saveFileName}-modsave-*.celeste")) {
334336
string file = Path.GetFileNameWithoutExtension(modSaveFile);
335-
Logger.Info("SaveData", $"Save slot {slot} has modsave {file} which was not cleaned, deleting file");
337+
Logger.Info("SaveData", $"Save slot {saveFileName} has modsave {file} which was not cleaned, deleting file");
336338
UserIO.Delete(file);
337339
}
338340

339-
foreach (string modSessionFile in Directory.GetFiles(saveFilePath, $"{slot}-modsession-*.celeste")) {
341+
foreach (string modSessionFile in Directory.GetFiles(saveFilePath, $"{saveFileName}-modsession-*.celeste")) {
340342
string file = Path.GetFileNameWithoutExtension(modSessionFile);
341-
Logger.Info("SaveData", $"Save slot {slot} has modsession {file} which was not cleaned, deleting file");
343+
Logger.Info("SaveData", $"Save slot {saveFileName} has modsession {file} which was not cleaned, deleting file");
342344
UserIO.Delete(file);
343345
}
344346
}
345347

346348
LoadedModSaveDataIndex = int.MinValue;
347349

348350
// delete the modsavedata file if it exists.
349-
string modSaveDataName = GetFilename(slot) + "-modsavedata";
351+
string modSaveDataName = $"{saveFileName}-modsavedata";
350352
if (UserIO.Exists(modSaveDataName)) {
351353
return UserIO.Delete(modSaveDataName);
352354
} else {
@@ -407,10 +409,11 @@ public static bool TryDeleteModSaveData(int slot) {
407409
if (LevelSets.Count <= 1 && LevelSetRecycleBin.Count == 0 && !HasModdedSaveData) {
408410
// the save file doesn't have any mod save data (just created, overwritten by vanilla, or Everest just updated).
409411
// we want to carry mod save data that was backed up in the mod save file, if any.
410-
ModSaveData modSaveData = UserIO.Load<ModSaveData>(GetFilename(FileSlot) + "-modsavedata");
412+
string saveFileName = GetFilename(FileSlot);
413+
ModSaveData modSaveData = UserIO.Load<ModSaveData>($"{saveFileName}-modsavedata");
411414
if (modSaveData != null) {
412415
modSaveData.CopyToCelesteSaveData(this);
413-
Logger.Warn("SaveData", $"{LevelSets.Count} level set(s) were restored from mod backup for save slot {FileSlot}");
416+
Logger.Warn("SaveData", $"{LevelSets.Count} level set(s) were restored from mod backup for save slot {saveFileName}");
414417
}
415418
}
416419

0 commit comments

Comments
 (0)