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

Method copy_dir

src/storage.rs:535–556  ·  view source on GitHub ↗
(source: &Path, target: &Path)

Source from the content-addressed store, hash-verified

533 }
534
535 fn copy_dir(source: &Path, target: &Path) -> io::Result<u64> {
536 Self::create_dir_all(target)?;
537 let mut bytes = 0;
538 let mut entries = fs::read_dir(source)?.collect::<io::Result<Vec<_>>>()?;
539 entries.sort_by_key(std::fs::DirEntry::path);
540 for entry in entries {
541 let source_path = entry.path();
542 let target_path = target.join(entry.file_name());
543 let meta = source_path.symlink_metadata()?;
544 if meta.file_type().is_symlink() {
545 return Err(invalid_input(
546 "private store artifact source must not contain symlinks",
547 ));
548 }
549 if meta.is_dir() {
550 bytes += Self::copy_dir(&source_path, &target_path)?;
551 } else if meta.is_file() {
552 bytes += Self::copy_artifact(&source_path, &target_path)?;
553 }
554 }
555 Ok(bytes)
556 }
557}
558
559fn reject_symlink_components(path: &Path, subject: &str) -> io::Result<()> {

Callers

nothing calls this directly

Calls 2

invalid_inputFunction · 0.85
copy_dirFunction · 0.50

Tested by

no test coverage detected