Skip to content

Commit

Permalink
Add extra error checking for local save manager
Browse files Browse the repository at this point in the history
  • Loading branch information
jtsage committed Feb 16, 2024
1 parent 2224100 commit 5a694d8
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/modAssist_func_lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -1636,6 +1636,7 @@ const saveManage = {
if ( results.errorList.length === 0 ) {
serveIPC.windowLib.sendToValidWindow('save_manage', 'fromMain_saveImport', result.filePaths[0])
} else {
serveIPC.windowLib.doDialogBox('save_manage', { type : 'warning', titleL10n : 'load_save_import_title', messageL10n : 'load_save_import_failed' })
saveManage.log.danger('Invalid Save File')
}
})
Expand Down
5 changes: 3 additions & 2 deletions renderer/renderJS/savemanage_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
let uuidMap = {}

window.mods.receive('fromMain_saveImport', (savePath) => {
console.log(savePath)
fsgUtil.setContent({
save_import_path : savePath,
})
Expand All @@ -20,8 +21,8 @@ window.mods.receive('fromMain_saveInfo', (modCollect) => {
uuidMap = {}
const theseSaves = modCollect.opts.saveInfo

const activeIDS = Object.keys(theseSaves).filter((x) => theseSaves[x].active !== false && theseSaves[x].active.error === false)
const backIDS = Object.keys(theseSaves).filter((x) => theseSaves[x].backups.length !== 0 )
const activeIDS = Object.keys(theseSaves).filter((x) => typeof theseSaves[x].active === 'object' && theseSaves[x].active?.error === false)
const backIDS = Object.keys(theseSaves).filter((x) => Array.isArray(theseSaves[x].backups) && theseSaves[x].backups.length !== 0 )

const activeGameHTML = []
const backGameHTML = []
Expand Down
2 changes: 2 additions & 0 deletions translations/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "请在 gameSettings.xml 文件中将此收藏夹设置为激活状态",
"list-none" : "取消激活",
"list-none__title" : "请在 gameSettings.xml 文件中取消激活覆盖。",
"load_save_import_failed" : "无法读取指定的保存文件,无法继续导入。",
"load_save_import_title" : "无效保存文件",
"loading_cache_subtitle" : "清理额外的缓存条目 (较慢)",
"loading_cache_title" : "清除缓存",
"loading_download_subtitle" : "Please wait, this could take a minute",
Expand Down
2 changes: 2 additions & 0 deletions translations/cz.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "Nastavte tuto kolekci Aktivní v herním Settings.xml",
"list-none" : "Deaktivovat",
"list-none__title" : "Deaktivovat přepsání v herním Settings.xml",
"load_save_import_failed" : "Nelze přečíst zadaný uložený soubor, nelze pokračovat v importu.",
"load_save_import_title" : "Neplatný soubor pro uložení",
"loading_cache_subtitle" : "Čištění extra položek mezipaměti (pomalé!)",
"loading_cache_title" : "Vyčistit mezipaměť",
"loading_download_subtitle" : "Počkejte prosím, může to chvíli trvat",
Expand Down
2 changes: 2 additions & 0 deletions translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "Diese Sammlung in gameSettings.xml auf Aktiv setzen",
"list-none" : "Deaktivieren",
"list-none__title" : "Deaktivieren der Überschreibung in gameSettings.xml",
"load_save_import_failed" : "Die angegebene Speicherdatei kann nicht gelesen werden, der Import kann nicht fortgesetzt werden.",
"load_save_import_title" : "Ungültige Speicherdatei",
"loading_cache_subtitle" : "Bereinigung zusätzlicher Cache-Einträge (langsam!)",
"loading_cache_title" : "Cache reinigen",
"loading_download_subtitle" : "Bitte warten. Dies kann einige Minuten dauern",
Expand Down
2 changes: 2 additions & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "Set this Collection Active in gameSettings.xml",
"list-none" : "Deactivate",
"list-none__title" : "Deactivate override in gameSettings.xml",
"load_save_import_failed" : "Unable to read specified save file, unable to continue import.",
"load_save_import_title" : "Invalid Save File",
"loading_cache_subtitle" : "Cleaning extra cache entries (slow!)",
"loading_cache_title" : "Cleaning Cache",
"loading_download_subtitle" : "Please wait, this could take a minute",
Expand Down
2 changes: 2 additions & 0 deletions translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "Establece esta colección como activa en gameSettings.xml",
"list-none" : "Desactivar",
"list-none__title" : "Desactivar la anulación en gameSettings.xml",
"load_save_import_failed" : "No se ha podido leer el archivo guardado especificado, no se puede continuar con la importación.",
"load_save_import_title" : "Archivo de almacenamiento no válido",
"loading_cache_subtitle" : "Limpieza de entradas de caché adicionales (¡lento!)",
"loading_cache_title" : "Limpieza de la caché",
"loading_download_subtitle" : "Por favor, espere, esto puede tardar un minuto",
Expand Down
2 changes: 2 additions & 0 deletions translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "Définissez cette collection active dans gameSettings.xml.",
"list-none" : "Désactiver",
"list-none__title" : "Désactiver la surcharge dans gameSettings.xml",
"load_save_import_failed" : "Impossible de lire le fichier d'enregistrement spécifié, impossible de poursuivre l'importation.",
"load_save_import_title" : "Fichier d'enregistrement invalide",
"loading_cache_subtitle" : "Nettoyage des entrées supplémentaires dans le cache (lent !)",
"loading_cache_title" : "Nettoyage du cache",
"loading_download_subtitle" : "Veuillez patienter. Cette action peut prendre quelques minutes",
Expand Down
2 changes: 2 additions & 0 deletions translations/lv.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "Iestatiet šo kolekciju Active in gameSettings.xml",
"list-none" : "Deaktivizēt",
"list-none__title" : "Deaktivizēt override in gameSettings.xml",
"load_save_import_failed" : "Nevar nolasīt norādīto saglabāšanas failu, nevar turpināt importēšanu.",
"load_save_import_title" : "Nederīgs saglabāšanas fails",
"loading_cache_subtitle" : "Papildu kešatmiņas ierakstu tīrīšana (lēni!)",
"loading_cache_title" : "Cache tīrīšana",
"loading_download_subtitle" : "Lūdzu, pagaidiet, tas var aizņemt minūti",
Expand Down
2 changes: 2 additions & 0 deletions translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "Stel deze collectie actief in gameSettings.xml",
"list-none" : "Deactiveer",
"list-none__title" : "Deactiveer override in gameSettings.xml",
"load_save_import_failed" : "Kan opgegeven opslagbestand niet lezen, kan import niet voortzetten.",
"load_save_import_title" : "Ongeldig bestand opslaan",
"loading_cache_subtitle" : "Opschonen van extra cache entries (traag!)",
"loading_cache_title" : "Cache schoonmaken",
"loading_download_subtitle" : "Geduld a.u.b., dit kan enkele minuten duren",
Expand Down
2 changes: 2 additions & 0 deletions translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "Ustaw ten folder jako aktywny w gameSettings.xml",
"list-none" : "Dezaktywuj",
"list-none__title" : "Dezaktywuj nadpisywanie w gameSettings.xml",
"load_save_import_failed" : "Nie można odczytać określonego pliku zapisu, nie można kontynuować importu.",
"load_save_import_title" : "Nieprawidłowy plik zapisu",
"loading_cache_subtitle" : "Czyszczenie dodatkowych wpisów w pamięci podręcznej (wolno!)",
"loading_cache_title" : "Czyszczenie pamięci podręcznej",
"loading_download_subtitle" : "Proszę czekać, to może potrwać minutę",
Expand Down
2 changes: 2 additions & 0 deletions translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "Definir esta coleção como ativa em gameSettings.xml",
"list-none" : "Desativar",
"list-none__title" : "Desativar substituição em gameSettings.xml",
"load_save_import_failed" : "Não foi possível ler o ficheiro guardado especificado, não é possível continuar a importação.",
"load_save_import_title" : "Ficheiro de gravação inválido",
"loading_cache_subtitle" : "Limpando entradas de cache adicionais (lento!)",
"loading_cache_title" : "limpeza de cache",
"loading_download_subtitle" : "Aguarde, isso pode levar um minuto.",
Expand Down
2 changes: 2 additions & 0 deletions translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@
"list-active__title" : "Активировать эту коллекцию в файле gameSettings.xml.",
"list-none" : "Деактивировать",
"list-none__title" : "Деактивировать переопределение в gameSettings.xml",
"load_save_import_failed" : "Невозможно прочитать указанный файл сохранения, невозможно продолжить импорт.",
"load_save_import_title" : "Недопустимый файл сохранения",
"loading_cache_subtitle" : "Очистка лишних записей в кеше (медленно!)",
"loading_cache_title" : "Очистка кеша",
"loading_download_subtitle" : "Пожалуйста, подождите, это может занять минуту",
Expand Down

0 comments on commit 5a694d8

Please sign in to comment.