diff options
Diffstat (limited to 'alacritty')
-rw-r--r-- | alacritty/Cargo.toml | 4 | ||||
-rw-r--r-- | alacritty/src/config/mod.rs | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml index 081ea4dc..2c94093d 100644 --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -30,6 +30,7 @@ copypasta = { version = "0.7.0", default-features = false } libc = "0.2" unicode-width = "0.1" bitflags = "1" +dirs = "2.0.2" [build-dependencies] gl_generator = "0.14.0" @@ -43,9 +44,6 @@ image = { version = "0.23.3", default-features = false, features = ["ico"], opti [target.'cfg(target_os = "macos")'.dependencies] objc = "0.2.2" -[target.'cfg(any(target_os = "macos", windows))'.dependencies] -dirs = "2.0.2" - [target.'cfg(not(any(target_os="windows", target_os="macos")))'.dependencies] x11-dl = { version = "2", optional = true } wayland-client = { version = "0.28.0", features = ["dlopen"], optional = true } diff --git a/alacritty/src/config/mod.rs b/alacritty/src/config/mod.rs index d24e8519..f9ee3528 100644 --- a/alacritty/src/config/mod.rs +++ b/alacritty/src/config/mod.rs @@ -211,7 +211,7 @@ fn load_imports(config: &Value, config_paths: &mut Vec<PathBuf>, recursion_limit let mut merged = Value::Null; for import in imports { - let path = match import { + let mut path = match import { Value::String(path) => PathBuf::from(path), _ => { error!( @@ -222,6 +222,11 @@ fn load_imports(config: &Value, config_paths: &mut Vec<PathBuf>, recursion_limit }, }; + // Resolve paths relative to user's home directory. + if let (Ok(stripped), Some(home_dir)) = (path.strip_prefix("~/"), dirs::home_dir()) { + path = home_dir.join(stripped); + } + if !path.exists() { info!(target: LOG_TARGET_CONFIG, "Skipping importing config; not found:"); info!(target: LOG_TARGET_CONFIG, " {:?}", path.display()); |