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>)
| 427 | /// Split out so the override precedence is unit-testable without mutating |
| 428 | /// process environment (which is racy and platform-sensitive). |
| 429 | fn global_config_dir_from(env_override: Option<std::ffi::OsString>) -> Option<PathBuf> { |
| 430 | if let Some(dir) = env_override { |
| 431 | return Some(PathBuf::from(dir)); |
| 432 | } |
| 433 | dirs::home_dir().map(|p| p.join(".atomic")) |
| 434 | } |
| 435 | |
| 436 | /// Get the global configuration file path |
| 437 | pub fn global_config_path() -> Option<PathBuf> { |
no outgoing calls