Skip to main content

collapse_home

Function collapse_home 

Source
pub fn collapse_home(path: &str) -> String
Expand description

Replace the home directory prefix with ~ for display purposes.

This is the inverse of expand_path: given an absolute path like /Users/alice/.zig/workflows/foo.zwf, returns ~/.zig/workflows/foo.zwf. Paths that don’t start with the home directory are returned unchanged.