MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / copy_symlink

Function copy_symlink

crates/openshell-driver-vm/src/driver.rs:3963–3977  ·  view source on GitHub ↗
(source_path: &Path, dest_path: &Path)

Source from the content-addressed store, hash-verified

3961
3962#[cfg(unix)]
3963fn copy_symlink(source_path: &Path, dest_path: &Path) -> Result<(), String> {
3964 let target = fs::read_link(source_path)
3965 .map_err(|err| format!("readlink {}: {err}", source_path.display()))?;
3966 remove_path_if_exists(dest_path)?;
3967 if let Some(parent) = dest_path.parent() {
3968 fs::create_dir_all(parent).map_err(|err| format!("create {}: {err}", parent.display()))?;
3969 }
3970 std::os::unix::fs::symlink(&target, dest_path).map_err(|err| {
3971 format!(
3972 "symlink {} to {}: {err}",
3973 target.display(),
3974 dest_path.display()
3975 )
3976 })
3977}
3978
3979#[cfg(not(unix))]
3980fn copy_symlink(_source_path: &Path, _dest_path: &Path) -> Result<(), String> {

Callers 1

merge_layer_directoryFunction · 0.85

Calls 1

remove_path_if_existsFunction · 0.85

Tested by

no test coverage detected