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

Function format_asset_file

perro_source/devtools/perro_cli/src/project.rs:603–632  ·  view source on GitHub ↗
(path: &Path, dedup: bool)

Source from the content-addressed store, hash-verified

601 status.code()
602 ));
603 }
604 log_done("User Scripts Clippy Clean");
605 Ok(())
606}
607
608fn resolve_project_res_root(path: &Path, command: &str) -> Result<PathBuf, String> {
609 let path = path.canonicalize().unwrap_or_else(|_| path.to_path_buf());
610
611 // `--path` must point at project root.
612 if path.join("project.toml").exists() {
613 return Ok(path.join("res"));
614 }
615
616 Err(format!(
617 "invalid --path `{}` for {command}. Use project root (directory containing project.toml).",
618 path.display()
619 ))
620}
621
622pub(crate) fn collect_rs_files_recursive(dir: &Path, out: &mut Vec<PathBuf>) -> Result<(), String> {
623 if !dir.exists() {
624 return Ok(());
625 }
626 let entries = fs::read_dir(dir)
627 .map_err(|err| format!("failed to read directory {}: {err}", dir.display()))?;
628 for entry in entries {
629 let entry = entry
630 .map_err(|err| format!("failed to read directory entry in {}: {err}", dir.display()))?;
631 let path = entry.path();
632 if path.is_dir() {
633 collect_rs_files_recursive(&path, out)?;
634 } else if path.extension().is_some_and(|ext| ext == "rs") {
635 out.push(path);

Callers 1

format_commandFunction · 0.85

Calls 6

catch_unwind_silentFunction · 0.85
to_text_with_dedupMethod · 0.80
parse_scene_docMethod · 0.80
writeFunction · 0.50
as_strMethod · 0.45

Tested by

no test coverage detected