Connect applications to schemes, filetypes, and more on macOS (more to come)
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

canoncalizing the bundle id

i hate zoom for doing this

+13 -11
+13 -11
infat-lib/src/macos/launch_services_db.rs
··· 2 2 //! Launch Services database parsing for the init command 3 3 4 4 use crate::error::{InfatError, Result}; 5 + use crate::macos::workspace::{self, resolve_to_bundle_id}; 5 6 use plist::Value; 6 7 use serde::{Deserialize, Serialize}; 7 8 use std::collections::HashMap; ··· 85 86 "Successfully loaded Launch Services database with {} handlers", 86 87 db.handlers.len() 87 88 ); 89 + 88 90 Ok(db) 89 91 } 90 92 ··· 114 116 continue; 115 117 } 116 118 117 - // Get app name from bundle ID 118 - let app_name = match crate::macos::workspace::get_app_name_from_bundle_id(&bundle_id) { 119 - Ok(name) => name, 120 - Err(InfatError::SystemService { .. }) => { 121 - debug!("Skipping system service: {}", bundle_id); 122 - skipped_count += 1; 123 - continue; 124 - } 125 - Err(InfatError::ApplicationNotFound { .. }) => { 119 + // Canonicalize the id 120 + let canonical_id = match resolve_to_bundle_id(&bundle_id) { 121 + Ok(id) => id, 122 + Err(_) => { 123 + // couldn’t resolve, so skip or warn 126 124 if robust { 127 - warn!("Application not found for bundle ID: {}", bundle_id); 125 + warn!("Skipping unresolved bundle id {:?}", bundle_id); 128 126 skipped_count += 1; 129 127 continue; 130 128 } else { 131 129 return Err(InfatError::ApplicationNotFound { name: bundle_id }); 132 130 } 133 131 } 132 + }; 133 + 134 + let app_name = match workspace::get_app_name_from_bundle_id(&canonical_id) { 135 + Ok(name) => name, 134 136 Err(e) => { 135 137 if robust { 136 - warn!("Failed to get app name for {}: {}", bundle_id, e); 138 + warn!("Skipping {}: {}", canonical_id, e); 137 139 skipped_count += 1; 138 140 continue; 139 141 } else {