diff --git a/src/gentodo/commands.py b/src/gentodo/commands.py index 1c58f88..03c68be 100644 --- a/src/gentodo/commands.py +++ b/src/gentodo/commands.py @@ -7,7 +7,9 @@ from gentodo import bugs OLD_PATH = os.path.expanduser("~/.local/share/todo/todo.json") -STORAGE_DIR = os.path.expanduser("~/.local/share/gentodo") +STORAGE_DIR = os.path.join( + os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share")), + "gentodo") TODO_FILE = os.path.join(STORAGE_DIR, "todo.json") class Gentodo: diff --git a/src/gentodo/config.py b/src/gentodo/config.py index caa850d..e89c8db 100644 --- a/src/gentodo/config.py +++ b/src/gentodo/config.py @@ -7,14 +7,16 @@ import os import subprocess -STORAGE_DIR = os.path.expanduser("~/.config/gentodo") -CONFIG_FILE = os.path.join(STORAGE_DIR, "config.toml") +CONFIG_DIR = os.path.join( + os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")), + "gentodo") +CONFIG_FILE = os.path.join(CONFIG_DIR, "config.toml") class Config: '''Class to handle the configuration file settings''' def __init__(self): if not os.path.isfile(CONFIG_FILE): - os.makedirs(STORAGE_DIR) + os.makedirs(CONFIG_DIR) with open(CONFIG_FILE, "w", encoding="utf_8") as config: config.write("[gentodo]\n") self.data = self.load_config()