Skip to content

Commit 66ba687

Browse files
committed
Fixed saving while having a category selected
1 parent c4a5a29 commit 66ba687

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules
22
build
33
dist
44
saves
5-
settings.json
5+
DarkSoulsSaveManager
6+
settings.json*
67
debug.log
78
*.zip

app/core/coreService.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,17 @@
226226
return;
227227
}
228228

229-
filePath = filePath || svc.data.settings.saveFileLocation, backupFileName;
229+
filePath = filePath || svc.data.settings.saveFileLocation;
230230
fs.copyFileSync(filePath, backupFileName);
231231
var fileName = saveName;
232232
var type = 'manual';
233233
if (opts && opts.type) type = opts.type;
234234
var save = new Save(fileName, backupFileName, svc.data.settings.selectedCategory, type);
235235
svc.data.saves.push(save);
236236

237+
// Remove oldest autosaves that are higher then the max autosave count
238+
// svc.cleanupAutosaves();
239+
237240
svc.saveSettings();
238241
if (!filePath) {
239242
svc.showSuccessToast(messages.backupCreated)
@@ -268,7 +271,7 @@
268271
svc.showSuccessToast(messages.backupRestored);
269272
return;
270273
}
271-
274+
272275
svc.showSuccessToast(messages.backupDestBackupNotFound);
273276
};
274277

@@ -384,6 +387,24 @@
384387
svc.stopAutosave();
385388
}
386389
}, true);
390+
391+
// svc.cleanupAutosaves = function () {
392+
// if (!svc.data.settings.autosaveMaxLimit) return;
393+
// if (svc.data.saves.length === 0) return;
394+
// var autosaves = _.filter(svc.data.saves, x => x.type === 'auto');
395+
// if (autosaves.length > svc.data.settings.autosaveMaxCount) {
396+
// var toRemove = _(autosaves).sortBy(x => x.time).reverse().slice(parseInt(svc.data.settings.autosaveMaxCount)).value();
397+
// for (var i = 0; i < toRemove.length; i++) {
398+
// var currentSave = toRemove[i];
399+
// if (fs.existsSync(currentSave.path))
400+
// fs.unlinkSync(currentSave.path);
401+
// if (!fs.existsSync(currentSave.path)) {
402+
// svc.data.saves.splice(currentSave, 1);
403+
// }
404+
// }
405+
// console.log(toRemove);
406+
// }
407+
// };
387408
};
388409

389410

app/main/mainController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
};
6464

6565
vm.createBackup = function () {
66-
core.createBackup(vm.settings.selectedCategory);
66+
core.createBackup();
6767
vm.categorySelect();
6868
};
6969

0 commit comments

Comments
 (0)