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

Function read_project_device_selection

packages/server/src/main.rs:2343–2356  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2341}
2342
2343fn 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
2358fn write_project_device_selection(selection: &ProjectDeviceSelection) -> anyhow::Result<PathBuf> {
2359 let path = project_device_selection_path_for_root(&selection.project_root)?;

Callers 1

resolve_cli_device_udidFunction · 0.85

Calls 2

project_rootFunction · 0.85

Tested by

no test coverage detected