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

Function normalize_rel

perro_editor/res/scripts/assets/editor_file_watch.rs:119–126  ·  view source on GitHub ↗
(root: &Path, abs_or_rel: &str)

Source from the content-addressed store, hash-verified

117pub fn is_under_res(root: &Path, abs_or_rel: &str) -> bool {
118 let rel = normalize_rel(root, abs_or_rel);
119 rel == "res" || rel.starts_with("res/")
120}
121
122pub fn abs_scene_to_res(root: &Path, abs_or_rel: &str) -> Option<String> {
123 let rel = normalize_rel(root, abs_or_rel);
124 let rel = rel.strip_prefix("res/")?;
125 rel.ends_with(".scn").then(|| format!("res://{rel}"))
126}
127
128pub fn res_paths_from_sigs(sigs: &[FileSig]) -> Vec<String> {
129 sigs.iter()

Callers 2

is_under_resFunction · 0.85
abs_scene_to_resFunction · 0.85

Calls 1

rel_pathFunction · 0.70

Tested by

no test coverage detected