Skip to main content

elide_common_prefix

Function elide_common_prefix 

Source
pub fn elide_common_prefix<'a>(base: &str, target: &'a str) -> &'a str
Expand description

Elide the common directory prefix between a base path and a target path. Only strips complete directory segments (never partial filenames). Returns the remaining suffix of target.

Example: elide_common_prefix("a/b/c/foo.ts", "a/b/d/bar.ts")"d/bar.ts"