MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / copy_tree

Function copy_tree

tests/mcp_suite/fixture.rs:348–361  ·  view source on GitHub ↗

Recursively copies `src` into `dest`, preserving file mtimes so the staleness pipeline sees copied sources exactly as the template indexed them.

(src: &Path, dest: &Path)

Source from the content-addressed store, hash-verified

346/// staleness pipeline sees copied sources exactly as the template indexed
347/// them.
348fn copy_tree(src: &Path, dest: &Path) -> io::Result<()> {
349 fs::create_dir_all(dest)?;
350 for entry in fs::read_dir(src)? {
351 let entry = entry?;
352 let from = entry.path();
353 let to = dest.join(entry.file_name());
354 if entry.file_type()?.is_dir() {
355 copy_tree(&from, &to)?;
356 } else {
357 copy_file_preserving_mtime(&from, &to)?;
358 }
359 }
360 Ok(())
361}
362
363fn copy_file_preserving_mtime(src: &Path, dest: &Path) -> io::Result<()> {
364 fs::copy(src, dest)?;

Callers 3

seed_storeFunction · 0.85
build_templateFunction · 0.85

Calls 1

Tested by

no test coverage detected