Use xdg config path

This commit is contained in:
Alexander Wainwright
2025-12-27 12:13:22 +10:00
parent 3d8063d984
commit 6c00b8e733

View File

@@ -3,9 +3,6 @@ import os
import toml
# TODO: proper path loading
CONFIG_PATH = os.path.expanduser("~/.config/emulsion/config.toml")
# Default Schema
# This defines the "First Class" feel of the app, but is fully overridable.
DEFAULT_CONFIG = {
@@ -56,9 +53,17 @@ DEFAULT_CONFIG = {
}
}
def get_config_path():
xdg_config_home = os.environ.get(
'XDG_CONFIG_HOME', os.path.expanduser('~/.config')
)
return os.path.join(xdg_config_home, 'emulsion', 'config.toml')
class ConfigLoader:
def __init__(self, path=CONFIG_PATH):
self.path = path
def __init__(self, path=None):
self.path = path or get_config_path()
self.config = copy.deepcopy(DEFAULT_CONFIG)
def load(self):