diff --git a/lib/structs/settings.dart b/lib/structs/settings.dart index 377bb0e..e9ab9ab 100644 --- a/lib/structs/settings.dart +++ b/lib/structs/settings.dart @@ -162,7 +162,7 @@ class Settings { return PathHelper(pth: base_path).resolve("mods.jail").build(); } - String getWorldSnapshots() { + String getWorldSnapshotFolder() { return PathHelper(pth: base_path).resolve("backups").build(); } @@ -177,6 +177,17 @@ class Settings { return pth2.build(); // Fallback to game.db } + Future> getWorldSnapshotFiles() async { + Directory dir = Directory(getWorldSnapshotFolder()); + var lst = await dir.list().toList(); + List backupNames = []; + for(var file in lst) { + backupNames.add(file.path); + } + + return backupNames; + } + Future createModFolderIfNotExists() async { if (Directory(getModPath()).existsSync()) { return; @@ -194,10 +205,10 @@ class Settings { } Future createBackupsFolderIfNotExists() async { - if(Directory(getWorldSnapshots()).existsSync()) { + if(Directory(getWorldSnapshotFolder()).existsSync()) { return; }else { - await Directory(getWorldSnapshots()).create(recursive: true); + await Directory(getWorldSnapshotFolder()).create(recursive: true); } }