MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / erase

Method erase

packages/server/src/android.rs:300–323  ·  view source on GitHub ↗
(&self, id: &str)

Source from the content-addressed store, hash-verified

298 }
299
300 pub fn erase(&self, id: &str) -> Result<(), AppError> {
301 let avd_name = avd_from_id(id)?;
302 if self.resolve_serial(&avd_name).is_ok() {
303 return Err(AppError::bad_request(
304 "Shutdown the Android emulator before erasing it.",
305 ));
306 }
307 let avd_dir = self.avd_dir(&avd_name);
308 for file_name in [
309 "userdata-qemu.img",
310 "cache.img",
311 "data.img",
312 "sdcard.img",
313 "snapshots.img",
314 ] {
315 let path = avd_dir.join(file_name);
316 if path.exists() {
317 std::fs::remove_file(&path).map_err(|error| {
318 AppError::native(format!("Unable to remove {}: {error}", path.display()))
319 })?;
320 }
321 }
322 Ok(())
323 }
324
325 pub fn wait_until_booted(&self, id: &str, timeout_duration: Duration) -> Result<(), AppError> {
326 let avd_name = avd_from_id(id)?;

Callers 1

erase_simulatorFunction · 0.80

Calls 3

avd_from_idFunction · 0.85
resolve_serialMethod · 0.80
avd_dirMethod · 0.80

Tested by

no test coverage detected