(path: &Option<Utf8PlatformPathBuf>, appearance: &Appearance)
| 502 | } |
| 503 | |
| 504 | fn format_path(path: &Option<Utf8PlatformPathBuf>, appearance: &Appearance) -> RichText { |
| 505 | let mut color = appearance.replace_color; |
| 506 | let text = if let Some(dir) = path { |
| 507 | if let Some(rel) = dirs::home_dir() |
| 508 | .and_then(|home| check_path_buf(home).ok()) |
| 509 | .and_then(|home| dir.strip_prefix(&home).ok()) |
| 510 | { |
| 511 | format!("~{MAIN_SEPARATOR}{rel}") |
| 512 | } else { |
| 513 | dir.to_string() |
| 514 | } |
| 515 | } else { |
| 516 | color = appearance.delete_color; |
| 517 | "[none]".to_string() |
| 518 | }; |
| 519 | RichText::new(text).color(color).family(FontFamily::Monospace) |
| 520 | } |
| 521 | |
| 522 | pub const CONFIG_DISABLED_TEXT: &str = "Value is overridden by the project configuration."; |
| 523 |
no test coverage detected