extends Node # This manages the settings to make it easier for mee const SETTINGS_LOCATION:String = "user://settings.conf" # THESE ARE DEFAULT SETTINGS. var settings:Dictionary = { "PrivacyNoticeConfirmed":false, "Watches":[], "CookieA":"", "CookieB":"", "LastID":0, "ShowGallery":true, "ShowScraps":false, "ShowFavorites":false, "BlackList":[], "ReloadInt":7200.0, "DownloadDirs":{ "Pictures":OS.get_system_dir(OS.SYSTEM_DIR_PICTURES), "Documents":OS.get_system_dir(OS.SYSTEM_DIR_DOCUMENTS), "Downloads":OS.get_system_dir(OS.SYSTEM_DIR_DOWNLOADS), }, "Searches":[], "ExtraURLs":[], "UserBL":[], } var conf:ConfigFile = ConfigFile.new() var current_profile func _ready(): conf.load(SETTINGS_LOCATION) func load_profile(profile:String = "user"): for i in settings.keys(): if conf.has_section_key(profile,i): settings[i] = conf.get_value(profile,i) func save_profile(profile:String = "user"): for i in settings.keys(): conf.set_value(profile,i,settings[i]) conf.save(SETTINGS_LOCATION) # test json var f = File.new() f.open("user://newsettings.json",File.WRITE) f.store_string(to_json(settings)) f.close()