Honor XDG_CONFIG_HOME ENV variable

Following XDG Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
This commit is contained in:
Sijawusz Pur Rahnama 2023-03-06 20:18:49 +01:00
parent 749da0984c
commit 102e2834b6

View file

@ -24,9 +24,10 @@ class Ameba::Config
json: Formatter::JSONFormatter, json: Formatter::JSONFormatter,
} }
DEFAULT_PATHS = { XDG_CONFIG_HOME = ENV.fetch("XDG_CONFIG_HOME", "~/.config")
"~/.ameba.yml", DEFAULT_PATHS = {
"~/.config/ameba/config.yml", Path["~/.ameba.yml"],
Path[XDG_CONFIG_HOME] / "ameba/config.yml",
} }
FILENAME = ".ameba.yml" FILENAME = ".ameba.yml"
DEFAULT_PATH = Path[Dir.current] / FILENAME DEFAULT_PATH = Path[Dir.current] / FILENAME