Resolve the global config directory from an explicit override value. Split out so the override precedence is unit-testable without mutating process environment (which is racy and platform-sensitive).
(env_override: Option<std::ffi::OsString>)
| 1057 | /// Split out so the override precedence is unit-testable without mutating |
| 1058 | /// process environment (which is racy and platform-sensitive). |
| 1059 | fn global_config_dir_from(env_override: Option<std::ffi::OsString>) -> Option<PathBuf> { |
| 1060 | if let Some(dir) = env_override { |
| 1061 | return Some(PathBuf::from(dir)); |
| 1062 | } |
| 1063 | dirs::home_dir().map(|p| p.join(".atomic")) |
| 1064 | } |
| 1065 | |
| 1066 | /// Get the global configuration file path |
| 1067 | pub fn global_config_path() -> Option<PathBuf> { |
no outgoing calls