From a291e301402a8271c33a9a09d4b5035bf734be3c Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 17 Sep 2025 00:25:40 +0200 Subject: Store config files in their proper locations --- client/system/profile.gd | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'client/system/profile.gd') diff --git a/client/system/profile.gd b/client/system/profile.gd index 438e8e66..35706f2d 100644 --- a/client/system/profile.gd +++ b/client/system/profile.gd @@ -44,17 +44,21 @@ static var loaded_path: String static func load(path: String): # TOCTOU here. Godot docs says its fine. + print("Loading profile from %s" % path) if not FileAccess.file_exists(path): - print("Skip profile load") - return default_profile + print(" -> using default profile") + values = default_profile.duplicate_deep() + loaded_path = path + return var f = FileAccess.open(path, FileAccess.READ) values = f.get_var(true) + loaded_path = path if values != null and values is Dictionary: G.add_missing_keys(values, default_profile) - loaded_path = path static func save(): + DirAccess.make_dir_recursive_absolute(loaded_path.rsplit("/", true, 1)[0]) var f = FileAccess.open(loaded_path, FileAccess.WRITE) var to_save = values.duplicate(true) f.store_var(to_save, true) -- cgit v1.2.3-70-g09d2