MCPcopy Create free account
hub / github.com/PerroEngine/Perro / short_path

Function short_path

perro_editor/res/scripts/ui/editor_view.rs:1–7  ·  view source on GitHub ↗
(path: &str, max: usize)

Source from the content-addressed store, hash-verified

1pub fn short_path(path: &str, max: usize) -> String {
2 if path.len() <= max {
3 path.to_string()
4 } else {
5 format!("...{}", &path[path.len().saturating_sub(max - 3)..])
6 }
7}

Callers 6

refresh_manager_viewFunction · 0.85
refresh_tabs_viewFunction · 0.85
editor_status_textFunction · 0.85
scene_row_labelFunction · 0.85
file_row_labelFunction · 0.85

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected