From 929403386cd855a1715334db9c6c4cd1ae08f4a6 Mon Sep 17 00:00:00 2001 From: Alberto Corona Date: Sat, 7 Jan 2017 18:12:28 -0600 Subject: Support config path `$XDG_CONFIG/alacritty.yml` - Update README to reflect changes --- src/config.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/config.rs b/src/config.rs index 706f1d01..b3ca5bdb 100644 --- a/src/config.rs +++ b/src/config.rs @@ -812,7 +812,8 @@ impl Config { /// The config file is loaded from the first file it finds in this list of paths /// /// 1. $XDG_CONFIG_HOME/alacritty/alacritty.yml - /// 2. $HOME/.config/alacritty/alacritty.yml + /// 2. $XDG_CONFIG_HOME/alacritty.yml + /// 3. $HOME/.config/alacritty/alacritty.yml pub fn load() -> Result { let home = env::var("HOME")?; @@ -820,6 +821,11 @@ impl Config { let path = ::xdg::BaseDirectories::with_prefix("alacritty") .ok() .and_then(|xdg| xdg.find_config_file("alacritty.yml")) + .or_else(|| { + ::xdg::BaseDirectories::new().ok().and_then(|fallback| { + fallback.find_config_file("alacritty.yml") + }) + }) .unwrap_or_else(|| { // Fallback path: $HOME/.config/alacritty/alacritty.yml let mut alt_path = PathBuf::from(&home); -- cgit