2 parents 32fd1fd + cc25745 commit 6b6d26fCopy full SHA for 6b6d26f
1 file changed
src/config.rs
@@ -24,9 +24,13 @@ pub struct Config {
24
pub index_warn_threshold: Option<usize>,
25
}
26
27
-/// Return the global config path (`~/.config/vecgrep/config.toml`).
+/// Return the global config path (`$XDG_CONFIG_HOME/vecgrep/config.toml`,
28
+/// defaulting to `~/.config/vecgrep/config.toml`).
29
pub fn global_config_path() -> Option<PathBuf> {
- dirs::config_dir().map(|d| d.join("vecgrep").join("config.toml"))
30
+ std::env::var_os("XDG_CONFIG_HOME")
31
+ .map(PathBuf::from)
32
+ .or_else(|| dirs::home_dir().map(|h| h.join(".config")))
33
+ .map(|d| d.join("vecgrep").join("config.toml"))
34
35
36
/// Return the project config path (`<project_root>/.vecgrep/config.toml`).
0 commit comments