From d65217c9fc47654e423e5b147d55654008a5a6cc Mon Sep 17 00:00:00 2001 From: Bence Ferdinandy Date: Tue, 7 Jul 2026 13:45:50 +0200 Subject: [PATCH] fix(config): honor XDG_CONFIG_HOME on all platforms On MacOS XDG_CONFIG_HOME is not checked and mdterm falls back on the platform default config directory. When figuring out config_path, check if XDG_CONFIG_HOME is set explicitly on all platforms. Fixes: #66 --- src/config.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 187e03d..730ed8e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -39,5 +39,8 @@ impl Config { } fn config_path() -> Option { - dirs::config_dir().map(|d| d.join("mdterm").join("config.toml")) + let base = std::env::var_os("XDG_CONFIG_HOME") + .map(PathBuf::from) + .or_else(dirs::config_dir)?; + Some(base.join("mdterm").join("config.toml")) }