Function dt_core::utils::default_config_path
source · [−]Expand description
Gets the default config file path, according to $XDG_CONFIG_HOME or
$HOME, with last component specified by filename.
Example
std::env::set_var("HOME", "/tmp/john");
std::env::set_var("XDG_CONFIG_HOME", "/tmp/watson/.config");
assert_eq!(
default_config_path("cli.toml"),
PathBuf::from_str("/tmp/watson/.config/dt/cli.toml").unwrap(),
);
std::env::remove_var("XDG_CONFIG_HOME");
assert_eq!(
default_config_path("cli.toml"),
PathBuf::from_str("/tmp/john/.config/dt/cli.toml").unwrap(),
);