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.

recursive search for apps

This was necessary because home-manager now copies the apps, and this prevents
infat from finding applications in ~/Applications/Home Manager Apps and instead
would throw an error about the application being set. Running with -v confirmed
that the inside of the Home Manager Apps folder wasn't being checked

+10 -7
+10 -7
infat-lib/src/macos/workspace.rs
··· 134 134 pub fn find_applications() -> Result<Vec<PathBuf>> { 135 135 debug!("Searching for applications in standard directories"); 136 136 137 - let search_paths = [ 138 - "/Applications", 139 - "/System/Applications", 140 - "/System/Library/CoreServices/Applications", 141 - &format!("{}/Applications", std::env::var("HOME").unwrap_or_default()), 137 + let mut search_paths = vec![ 138 + "/Applications".to_string(), 139 + "/System/Applications".to_string(), 140 + "/System/Library/CoreServices/Applications".to_string(), 141 + format!("{}/Applications", std::env::var("HOME").unwrap_or_default().to_string()), 142 142 ]; 143 143 144 144 let mut apps = Vec::new(); 145 145 146 - for search_path in &search_paths { 147 - let path = Path::new(search_path); 146 + while search_paths.len() > 0 { 147 + let search_path = search_paths.pop().ok_or(InfatError::Generic { message: "Non-empty vector could not pop".to_string(), })?; 148 + let path = Path::new(&search_path); 148 149 if !path.exists() { 149 150 debug!("Skipping non-existent path: {}", search_path); 150 151 continue; ··· 169 170 if resolved_path.extension().is_some_and(|ext| ext == "app") { 170 171 apps.push(entry_path); 171 172 found_count += 1; 173 + } else if resolved_path.is_dir() { 174 + search_paths.push(resolved_path.to_str().expect("Invalid path UTF-8").to_string()); 172 175 } 173 176 } 174 177 debug!("Found {} apps in {}", found_count, search_path);