(current_dir: &Path)
| 156 | } |
| 157 | |
| 158 | fn 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 | |
| 174 | fn extract_resource(compressed: &[u8], dest: &Path) -> Result<(), String> { |
| 175 | if compressed.is_empty() { |
no test coverage detected