Start setting up the snapshots feature

This commit is contained in:
zontreck 2024-07-01 23:24:06 -07:00
parent 505e3c2cd7
commit b8426e286b
2 changed files with 24 additions and 0 deletions

View file

@ -49,6 +49,7 @@ void main() async {
await settings.createModFolderIfNotExists();
await settings.createServerModFolderIfNotExists();
await settings.createModJailFolderIfNotExists();
await settings.createBackupsFolderIfNotExists();
await settings.writeOutModListFile();
print("Finished checking for game server updates...");

View file

@ -162,6 +162,21 @@ class Settings {
return PathHelper(pth: base_path).resolve("mods.jail").build();
}
String getWorldSnapshots() {
return PathHelper(pth: base_path).resolve("backups").build();
}
String getWorldGameDB() {
var path = PathHelper(pth: getServerPath()).resolve("ConanSandbox").resolve("Saved");
var pth2 = path.resolve("game.db");
if(pth2.exists()) return pth2.build();
var pth1 = path.resolve("dlc_siptah.db");
if(pth1.exists()) return pth1.build();
return pth2.build(); // Fallback to game.db
}
Future<void> createModFolderIfNotExists() async {
if (Directory(getModPath()).existsSync()) {
return;
@ -178,6 +193,14 @@ class Settings {
}
}
Future<void> createBackupsFolderIfNotExists() async {
if(Directory(getWorldSnapshots()).existsSync()) {
return;
}else {
await Directory(getWorldSnapshots()).create(recursive: true);
}
}
bool serverInstalled() {
return File(
"${getServerPath()}${Platform.pathSeparator}ConanSandboxServer.exe")