MCPcopy Index your code
hub / github.com/encounter/objdiff / format_path

Function format_path

objdiff-gui/src/views/config.rs:504–520  ·  view source on GitHub ↗
(path: &Option<Utf8PlatformPathBuf>, appearance: &Appearance)

Source from the content-addressed store, hash-verified

502}
503
504fn 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
522pub const CONFIG_DISABLED_TEXT: &str = "Value is overridden by the project configuration.";
523

Callers 1

pick_folder_uiFunction · 0.85

Calls 1

check_path_bufFunction · 0.85

Tested by

no test coverage detected