Start to implement snapshotting
This commit is contained in:
parent
a2737c82f9
commit
e53fc977bc
5 changed files with 63 additions and 9 deletions
|
@ -33,6 +33,7 @@ class Settings {
|
|||
String steamcmd_path = "";
|
||||
String game_path = "";
|
||||
String base_path = "";
|
||||
String gameServerDBFile = "";
|
||||
bool FTS = true;
|
||||
Credentials serverLoginCreds =
|
||||
Credentials(username: "admin", password: "changeMe123");
|
||||
|
@ -51,6 +52,7 @@ class Settings {
|
|||
tag.put("steamcmd", StringTag.valueOf(steamcmd_path));
|
||||
tag.put("game", StringTag.valueOf(game_path));
|
||||
tag.put("base", StringTag.valueOf(base_path));
|
||||
tag.put("dbfile", StringTag.valueOf(getWorldGameDB()));
|
||||
NbtUtils.writeBoolean(tag, "fts", FTS);
|
||||
|
||||
tag.put("server_creds", serverLoginCreds.save());
|
||||
|
@ -73,6 +75,9 @@ class Settings {
|
|||
steamcmd_path = tag.get("steamcmd")!.asString();
|
||||
game_path = tag.get("game")!.asString();
|
||||
base_path = tag.get("base")!.asString();
|
||||
if (tag.containsKey("dbfile"))
|
||||
gameServerDBFile = tag.get("dbfile")!.asString();
|
||||
|
||||
FTS = NbtUtils.readBoolean(tag, "fts"); // First Time Setup.
|
||||
// FTS should be disabled by the client when sending it back to the server in a C2SApplySettingsPacket
|
||||
|
||||
|
@ -167,12 +172,13 @@ class Settings {
|
|||
}
|
||||
|
||||
String getWorldGameDB() {
|
||||
var path = PathHelper(pth: getServerPath()).resolve("ConanSandbox").resolve("Saved");
|
||||
var path = PathHelper(pth: getServerPath())
|
||||
.resolve("ConanSandbox")
|
||||
.resolve("Saved");
|
||||
var pth2 = path.resolve("game.db");
|
||||
if(pth2.exists()) return pth2.build();
|
||||
if (pth2.exists()) return pth2.build();
|
||||
var pth1 = path.resolve("dlc_siptah.db");
|
||||
if(pth1.exists()) return pth1.build();
|
||||
|
||||
if (pth1.exists()) return pth1.build();
|
||||
|
||||
return pth2.build(); // Fallback to game.db
|
||||
}
|
||||
|
@ -181,7 +187,7 @@ class Settings {
|
|||
Directory dir = Directory(getWorldSnapshotFolder());
|
||||
var lst = await dir.list().toList();
|
||||
List<String> backupNames = [];
|
||||
for(var file in lst) {
|
||||
for (var file in lst) {
|
||||
backupNames.add(file.path);
|
||||
}
|
||||
|
||||
|
@ -205,9 +211,9 @@ class Settings {
|
|||
}
|
||||
|
||||
Future<void> createBackupsFolderIfNotExists() async {
|
||||
if(Directory(getWorldSnapshotFolder()).existsSync()) {
|
||||
if (Directory(getWorldSnapshotFolder()).existsSync()) {
|
||||
return;
|
||||
}else {
|
||||
} else {
|
||||
await Directory(getWorldSnapshotFolder()).create(recursive: true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue