Fix for munkicommon.getLSInstalledApplications(): use NSURL instead of FSRef, so no need to call LaunchServices.LSGetApplicationForURL(). Faster and hopefully more reliable.

This commit is contained in:
Greg Neagle
2012-04-27 10:25:19 -07:00
parent 3fcf49ffc4
commit f1f0846e2e
+3 -7
View File
@@ -1812,13 +1812,9 @@ def getLSInstalledApplications():
apps = LaunchServices._LSCopyAllApplicationURLs(None)
applist = []
for app in apps:
(status, fsobj, unused_url) = LaunchServices.LSGetApplicationForURL(
app, _unsigned(LaunchServices.kLSRolesAll), None, None)
if status != 0:
continue
app_path = fsobj.as_pathname()
if (app_path and not app_path.startswith('/Volumes/') and not
isExcludedFilesystem(app_path)):
app_path = app.path()
if (app_path and not isExcludedFilesystem(app_path) and
os.path.exists(app_path)):
applist.append(app_path)
return applist