Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver): locate Finder by name on macOS (#5390)

Antoine Bonnet5bc914abfd3b
diff --git a/libs/cua-driver/rust/crates/platform-macos/src/apps/mod.rs b/libs/cua-driver/rust/crates/platform-macos/src/apps/mod.rs
index af80ee2ca9..f2727365c0 100644
--- a/libs/cua-driver/rust/crates/platform-macos/src/apps/mod.rs
+++ b/libs/cua-driver/rust/crates/platform-macos/src/apps/mod.rs
@@ -684,6 +684,9 @@ pub(crate) fn locate_by_name(name: &str) -> Option<AppLocator> {
return Some(AppLocator::Path(path));
}
}
+ if app_name.eq_ignore_ascii_case("Finder.app") {
+ return resolve_bundle_id_to_locator("com.apple.finder");
+ }
// Fallback: maybe caller passed a bundle id as `name`. Use the
// Cryptex-safe locator (carries the bundle id, never the lossy
// url.path()).
@@ -1328,6 +1331,14 @@ mod tests {
assert_eq!(merged[1].pid, 42);
}
+ #[test]
+ fn finder_is_located_by_name_outside_the_app_roots() {
+ let (_, bundle_id) = super::locate_by_name("Finder")
+ .expect("Finder ships with every macOS")
+ .app_ref_and_bundle_id();
+ assert_eq!(bundle_id.as_deref(), Some("com.apple.finder"));
+ }
+
#[test]
fn finder_folder_handoff_is_narrowly_selected() {
let folder = std::env::temp_dir().to_string_lossy().into_owned();