(source_path: &Path, dest_path: &Path)
| 3961 | |
| 3962 | #[cfg(unix)] |
| 3963 | fn 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))] |
| 3980 | fn copy_symlink(_source_path: &Path, _dest_path: &Path) -> Result<(), String> { |
no test coverage detected