Store configuration in user configuration directory
This commit is contained in:
@ -2,6 +2,8 @@ import json
|
||||
import os
|
||||
from typing import Any, Generator
|
||||
|
||||
from .resources import ResourceManager
|
||||
|
||||
|
||||
class Settings:
|
||||
"""
|
||||
@ -81,13 +83,14 @@ class Settings:
|
||||
"""
|
||||
Loads the settings from a file
|
||||
"""
|
||||
if os.path.isfile("settings.json"):
|
||||
with open("settings.json", "r") as f:
|
||||
file_path = ResourceManager.get_config_path("settings.json")
|
||||
if os.path.isfile(file_path):
|
||||
with open(file_path, "r") as f:
|
||||
self.loads_from_string(f.read())
|
||||
|
||||
def write_settings(self) -> None:
|
||||
"""
|
||||
Dumps the settings into a file
|
||||
"""
|
||||
with open("settings.json", "w") as f:
|
||||
with open(ResourceManager.get_config_path("settings.json"), "w") as f:
|
||||
f.write(self.dumps_to_string())
|
||||
|
Reference in New Issue
Block a user