MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / read_injected_bundles

Function read_injected_bundles

packages/server/src/camera.rs:453–473  ·  view source on GitHub ↗
(udid: &str)

Source from the content-addressed store, hash-verified

451}
452
453fn read_injected_bundles(udid: &str) -> Vec<String> {
454 let path = injected_bundles_file(udid);
455 let Ok(data) = fs::read(path) else {
456 return Vec::new();
457 };
458 let Ok(value) = serde_json::from_slice::<Value>(&data) else {
459 return Vec::new();
460 };
461 let stored_pid = value.get("daemonPid").and_then(Value::as_u64).unwrap_or(0) as u32;
462 if stored_pid != std::process::id() {
463 return Vec::new();
464 }
465 value
466 .get("bundleIds")
467 .and_then(Value::as_array)
468 .into_iter()
469 .flatten()
470 .filter_map(Value::as_str)
471 .map(ToOwned::to_owned)
472 .collect()
473}
474
475fn camera_state_dir() -> PathBuf {
476 std::env::temp_dir().join("simdeck-camera")

Callers 1

record_injected_bundleFunction · 0.85

Calls 3

injected_bundles_fileFunction · 0.85
readFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected