extends Node var cfg_path = "user://settings.cfg" @onready var configuration = get_settings() func save(): Common.msg_debug("Save to config file : %s/%s" % [OS.get_user_data_dir(), cfg_path.replace("user://", "")]) var file = ConfigFile.new() for section in configuration.keys(): for key in configuration[section].keys(): file.set_value(section, key, configuration[section][key]) file.save(cfg_path) func get_settings(): var cfg = {} var config = ConfigFile.new() var cfg_file_content = config.load(cfg_path) if cfg_file_content != OK: return cfg for section in config.get_sections(): print ("Config section : %s" % section) for parameter in config.get_section_keys(section): print("Config parameter : %s" % parameter) cfg[section] = {parameter:config.get_value(section, parameter)} return cfg