Skip to main content

truncate_path_tail

Function truncate_path_tail 

Source
fn truncate_path_tail(path: &str, max_width: usize) -> String
Expand description

Truncate a filesystem path to show only the most specific directories. Walks forward to the first path separator after the truncation point to avoid splitting mid-component.

Examples:

  • C:\Users\user\AppData\...\SaveGames…\AppData\...\SaveGames
  • A short path that fits max_width is returned unchanged.