Skip to content

Commit

Permalink
Use mdfind to locate Atom.app if it isn't in /Applications
Browse files Browse the repository at this point in the history
  • Loading branch information
probablycorey committed Mar 13, 2014
1 parent 5490745 commit 2fd71f2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions atom.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/bin/sh
ATOM_PATH=${ATOM_PATH:-/Applications}
ATOM_APP_NAME=Atom.app

if [ -z "$ATOM_PATH" ]; then
for i in /Applications ~/Applications /Applications/Utilities ~/Applications/Utilities/ ~/Downloads ~/Desktop; do
if [ -x "$i/$ATOM_APP_NAME" ]; then
ATOM_PATH="$i"
break
fi
done
if [ ! -x "$ATOM_PATH/$ATOM_APP_NAME" ]; then
ATOM_PATH=$(mdfind "kMDItemCFBundleIdentifier == 'com.github.atom'" | head -1 | xargs dirname)
fi

if [ -z "$ATOM_PATH" ]; then
Expand Down

0 comments on commit 2fd71f2

Please sign in to comment.