summaryrefslogtreecommitdiff
path: root/alacritty/src/config/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty/src/config/mod.rs')
-rw-r--r--alacritty/src/config/mod.rs7
1 files changed, 6 insertions, 1 deletions
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());