(plist_path: &Path)
| 391 | } |
| 392 | |
| 393 | fn installed_arguments_from_plist(plist_path: &Path) -> anyhow::Result<Option<Vec<String>>> { |
| 394 | if !plist_path.exists() { |
| 395 | return Ok(None); |
| 396 | } |
| 397 | let plist = plist::Value::from_file(plist_path) |
| 398 | .with_context(|| format!("read {}", plist_path.display()))?; |
| 399 | let Some(arguments) = plist |
| 400 | .as_dictionary() |
| 401 | .and_then(|dict| dict.get("ProgramArguments")) |
| 402 | .and_then(|value| value.as_array()) |
| 403 | else { |
| 404 | return Ok(None); |
| 405 | }; |
| 406 | let arguments = arguments |
| 407 | .iter() |
| 408 | .filter_map(|value| value.as_string()) |
| 409 | .map(ToOwned::to_owned) |
| 410 | .collect::<Vec<_>>(); |
| 411 | Ok(Some(arguments)) |
| 412 | } |
| 413 | |
| 414 | fn installed_executable_path(arguments: &[String]) -> PathBuf { |
| 415 | arguments |
no test coverage detected