Skip to content

Commit

Permalink
Ensure util.appinfo() handles multiple apps with the same bundle ID
Browse files Browse the repository at this point in the history
  • Loading branch information
deanishe committed Jul 16, 2018
1 parent c2850b9 commit ec3a486
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Binary file not shown.
9 changes: 6 additions & 3 deletions workflow/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,18 @@ def appinfo(name):
AppInfo: :class:`AppInfo` tuple or ``None`` if app isn't found.
"""
cmd = ['mdfind', '-onlyin', '/',
cmd = ['mdfind', '-onlyin', '/Applications',
'-onlyin', os.expanduser('~/Applications'),
'(kMDItemContentTypeTree == com.apple.application &&'
'(kMDItemDisplayName == "{0}" || kMDItemFSName == "{0}.app"))'
.format(name)]

path = run_command(cmd).strip()
if not path:
output = run_command(cmd).strip()
if not output:
return None

path = output.split('\n')[0]

cmd = ['mdls', '-raw', '-name', 'kMDItemCFBundleIdentifier', path]
bid = run_command(cmd).strip()
if not bid: # pragma: no cover
Expand Down

0 comments on commit ec3a486

Please sign in to comment.