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

Function cleanup_old_versions

crates/openshell-driver-vm/src/embedded_runtime.rs:158–172  ·  view source on GitHub ↗
(current_dir: &Path)

Source from the content-addressed store, hash-verified

156}
157
158fn cleanup_old_versions(current_dir: &Path) -> Result<(), String> {
159 let base = runtime_cache_base()?;
160 if !base.exists() {
161 return Ok(());
162 }
163
164 let entries = fs::read_dir(&base).map_err(|e| format!("read {}: {e}", base.display()))?;
165 for entry in entries.filter_map(Result::ok) {
166 let path = entry.path();
167 if path.is_dir() && !current_dir.starts_with(&path) && path != current_dir {
168 let _ = fs::remove_dir_all(&path);
169 }
170 }
171 Ok(())
172}
173
174fn extract_resource(compressed: &[u8], dest: &Path) -> Result<(), String> {
175 if compressed.is_empty() {

Callers 1

ensure_runtime_extractedFunction · 0.85

Calls 3

runtime_cache_baseFunction · 0.85
existsMethod · 0.80
pathMethod · 0.80

Tested by

no test coverage detected