(udid: &str)
| 451 | } |
| 452 | |
| 453 | fn 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 | |
| 475 | fn camera_state_dir() -> PathBuf { |
| 476 | std::env::temp_dir().join("simdeck-camera") |
no test coverage detected