()
| 2341 | } |
| 2342 | |
| 2343 | fn read_project_device_selection() -> anyhow::Result<Option<ProjectDeviceSelection>> { |
| 2344 | let root = project_root()?; |
| 2345 | let path = project_device_selection_path_for_root(&root)?; |
| 2346 | if !path.exists() { |
| 2347 | return Ok(None); |
| 2348 | } |
| 2349 | let data = fs::read_to_string(&path).with_context(|| format!("read {}", path.display()))?; |
| 2350 | let selection = serde_json::from_str::<ProjectDeviceSelection>(&data) |
| 2351 | .with_context(|| format!("parse simulator selection {}", path.display()))?; |
| 2352 | if selection.project_root != root { |
| 2353 | return Ok(None); |
| 2354 | } |
| 2355 | Ok(Some(selection)) |
| 2356 | } |
| 2357 | |
| 2358 | fn write_project_device_selection(selection: &ProjectDeviceSelection) -> anyhow::Result<PathBuf> { |
| 2359 | let path = project_device_selection_path_for_root(&selection.project_root)?; |
no test coverage detected