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
1 changed files with 4 additions and 3 deletions

View File

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