|
|
@ -13,16 +13,30 @@ export xdg_data_home, xdg_data_dirs, xdg_config_home, xdg_config_dirs, |
|
|
|
xdg_cache_home, save_config_path, save_data_path, save_cache_path, |
|
|
|
load_config_paths, load_data_paths, get_runtime_dir |
|
|
|
|
|
|
|
""" |
|
|
|
`\$XDG_DATA_HOME` or the default, `~/.local/share` |
|
|
|
""" |
|
|
|
xdg_data_home = get(ENV, "XDG_DATA_HOME", joinpath(Sys.homedir(), ".local", "share")) |
|
|
|
|
|
|
|
""" |
|
|
|
A list of directory paths in which application data may be stored, in preference order. |
|
|
|
""" |
|
|
|
xdg_data_dirs = [xdg_data_home; |
|
|
|
filter(!isempty, split(get(ENV, "XDG_DATA_DIRS", "/usr/local/share:/usr/share"), ":"))] |
|
|
|
|
|
|
|
""" |
|
|
|
`\$XDG_CONFIG_HOME` or the default, `~/.config` |
|
|
|
""" |
|
|
|
xdg_config_home = get(ENV, "XDG_CONFIG_HOME", joinpath(Sys.homedir(), ".config")) |
|
|
|
|
|
|
|
""" |
|
|
|
A list of directory paths in which configuration may be stored, in preference order. |
|
|
|
""" |
|
|
|
xdg_config_dirs = [xdg_config_home; |
|
|
|
filter(!isempty, split(get(ENV, "XDG_CONFIG_DIRS", "/etc/xdg"), ":"))] |
|
|
|
|
|
|
|
""" |
|
|
|
`\$XDG_CACHE_HOME` or the default, `~/.cache` |
|
|
|
""" |
|
|
|
xdg_cache_home = get(ENV, "XDG_CACHE_HOME", joinpath(Sys.homedir(), ".cache")) |
|
|
|
|
|
|
|
""" |
|
|
@ -91,6 +105,11 @@ take precedence over later ones, and the user-specific config dir comes first. |
|
|
|
""" |
|
|
|
load_config_paths(resource...) = load_paths(xdg_config_dirs, resource...) |
|
|
|
|
|
|
|
""" |
|
|
|
function load_first_config(resource...) |
|
|
|
|
|
|
|
Returns the first result from load_config_paths, or None if there is nothing to load. |
|
|
|
""" |
|
|
|
function load_first_config(resource...) |
|
|
|
for config in load_config_paths(resource...) |
|
|
|
return config |
|
|
|