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

Function remove_path_if_exists

crates/openshell-driver-vm/src/driver.rs:3951–3960  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

3949}
3950
3951fn remove_path_if_exists(path: &Path) -> Result<(), String> {
3952 let Ok(metadata) = fs::symlink_metadata(path) else {
3953 return Ok(());
3954 };
3955 if metadata.file_type().is_dir() {
3956 fs::remove_dir_all(path).map_err(|err| format!("remove {}: {err}", path.display()))
3957 } else {
3958 fs::remove_file(path).map_err(|err| format!("remove {}: {err}", path.display()))
3959 }
3960}
3961
3962#[cfg(unix)]
3963fn copy_symlink(source_path: &Path, dest_path: &Path) -> Result<(), String> {

Callers 3

merge_layer_directoryFunction · 0.85
clear_directory_contentsFunction · 0.85
copy_symlinkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected