Update only the queue ID in settings.cfg
Saving a new queue ID wrote every setting from memory, which could also save a setting that is in use but not saved yet, like the debug winning score. Now it loads the file, changes only the queue ID and saves it again.
This commit is contained in:
1 parent
4a45e8516d
commit
62fa63fd8b
2 files changed
+41
-2
No files matched your search
+11
-2
@@ -181,10 +181,19 @@ func save_settings() -> void:
|
||||
GameLog.warning("Could not save the settings to %s: %s" % [path, error_string(error)])
|
||||
|
||||
|
||||
## Sets the play queue ID for [param server] and saves it.
|
||||
## Sets the play queue ID for [param server] and saves it. Only the ID is changed in
|
||||
## the file; the other settings in it stay as they were saved.
|
||||
func set_queue_id(server: String, id: String) -> void:
|
||||
queue_ids[server] = id
|
||||
save_settings()
|
||||
var path: String = saved_settings_path()
|
||||
var file: ConfigFile = ConfigFile.new()
|
||||
# A missing file is fine: it is written with only the queue ID
|
||||
file.load(path)
|
||||
file.set_value("queues", server, id)
|
||||
DirAccess.make_dir_recursive_absolute(path.get_base_dir())
|
||||
var error: Error = file.save(path)
|
||||
if error != OK:
|
||||
GameLog.warning("Could not save the queue ID to %s: %s" % [path, error_string(error)])
|
||||
|
||||
|
||||
## Turns fullscreen on or off and saves it.
|
||||
|
||||
Reference in new issue
Block a user