mirror of
https://github.com/starship/starship.git
synced 2024-11-28 19:24:54 +01:00
feat(context): keep default path for starship.toml
This commit is contained in:
parent
76aca7b0ad
commit
5f2eb186e2
@ -427,11 +427,15 @@ fn home_dir(env: &Env) -> Option<PathBuf> {
|
|||||||
utils::home_dir()
|
utils::home_dir()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn config_dir(env: &Env) -> Option<PathBuf> {
|
||||||
|
Some(home_dir(env)?.join(".config"))
|
||||||
|
}
|
||||||
|
|
||||||
fn config_home_dir(env: &Env) -> Option<PathBuf> {
|
fn config_home_dir(env: &Env) -> Option<PathBuf> {
|
||||||
if let Some(xdg_config_home) = env.get_env("XDG_CONFIG_HOME") {
|
if let Some(xdg_config_home) = env.get_env("XDG_CONFIG_HOME") {
|
||||||
Some(PathBuf::from(xdg_config_home))
|
Some(PathBuf::from(xdg_config_home))
|
||||||
} else {
|
} else {
|
||||||
Some(home_dir(env)?.join(".config"))
|
config_dir(env)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,9 +444,8 @@ fn get_config_path_os(env: &Env) -> Option<OsString> {
|
|||||||
return Some(config_path);
|
return Some(config_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
let config_dir = config_home_dir(env)?;
|
let config_file_path = config_dir(env)?.join("starship.toml");
|
||||||
let config_file_path = config_dir.join("starship.toml");
|
let folder_based_config_file_path = config_home_dir(env)?.join("starship/config.toml");
|
||||||
let folder_based_config_file_path = config_dir.join("starship/config.toml");
|
|
||||||
|
|
||||||
if config_file_path.exists() {
|
if config_file_path.exists() {
|
||||||
Some(config_file_path.into())
|
Some(config_file_path.into())
|
||||||
|
Loading…
Reference in New Issue
Block a user