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

Method copy_artifact

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

Source from the content-addressed store, hash-verified

514 }
515
516 pub fn copy_artifact(source: &Path, target: &Path) -> io::Result<u64> {
517 let meta = source.symlink_metadata()?;
518 if meta.file_type().is_symlink() {
519 return Err(invalid_input(
520 "private store artifact source must not be a symlink",
521 ));
522 }
523 reject_symlink_components(target, "private store artifact target")?;
524 if meta.is_dir() {
525 return Self::copy_dir(source, target);
526 }
527 if let Some(parent) = target.parent() {
528 Self::create_dir_all(parent)?;
529 }
530 let bytes = fs::copy(source, target)?;
531 set_private_file_permissions(target)?;
532 Ok(bytes)
533 }
534
535 fn copy_dir(source: &Path, target: &Path) -> io::Result<u64> {
536 Self::create_dir_all(target)?;

Callers

nothing calls this directly

Calls 4

invalid_inputFunction · 0.85
copy_dirFunction · 0.50

Tested by

no test coverage detected