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

Function extract_virtual_refs

perro_source/devtools/perro_cli/src/doctor.rs:358–378  ·  view source on GitHub ↗
(text: &str)

Source from the content-addressed store, hash-verified

356 if let Some(dlc_name) = parts.next() {
357 let dlc = dlc_name.as_os_str().to_string_lossy();
358 let rest = parts.as_path();
359 if rest.as_os_str().is_empty() {
360 return format!("dlc://{dlc}/");
361 }
362 return format!("dlc://{dlc}/{}", path_slash_for_doctor(rest));
363 }
364 }
365 path_slash_for_doctor(path)
366}
367
368fn path_slash_for_doctor(path: &Path) -> String {
369 path.to_string_lossy().replace('\\', "/")
370}
371
372fn line_number_at(text: &str, byte_index: usize) -> usize {
373 text[..byte_index.min(text.len())]
374 .bytes()
375 .filter(|b| *b == b'\n')
376 .count()
377 + 1
378}
379
380fn strip_comments_for_doctor(text: &str, hash_line_comment: bool) -> String {
381 let mut out = Vec::with_capacity(text.len());

Callers 2

validate_projectFunction · 0.85

Calls 6

line_number_atFunction · 0.85
findMethod · 0.80
as_strMethod · 0.45
pushMethod · 0.45
lenMethod · 0.45

Tested by 1