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

Function clear_directory_contents

crates/openshell-driver-vm/src/driver.rs:3940–3949  ·  view source on GitHub ↗
(dir: &Path)

Source from the content-addressed store, hash-verified

3938}
3939
3940fn clear_directory_contents(dir: &Path) -> Result<(), String> {
3941 if !dir.exists() {
3942 return Ok(());
3943 }
3944 for entry in fs::read_dir(dir).map_err(|err| format!("read {}: {err}", dir.display()))? {
3945 let entry = entry.map_err(|err| format!("read {}: {err}", dir.display()))?;
3946 remove_path_if_exists(&entry.path())?;
3947 }
3948 Ok(())
3949}
3950
3951fn remove_path_if_exists(path: &Path) -> Result<(), String> {
3952 let Ok(metadata) = fs::symlink_metadata(path) else {

Callers 1

merge_layer_directoryFunction · 0.85

Calls 3

remove_path_if_existsFunction · 0.85
existsMethod · 0.80
pathMethod · 0.80

Tested by

no test coverage detected