From 5da4846fff4555f5e098dfdef09e731d868fe360 Mon Sep 17 00:00:00 2001 From: Paul Wagland Date: Fri, 28 Nov 2014 00:37:21 +0100 Subject: [PATCH 1/2] Fix atom.sh when running from directory with space Deal with ATOM_PATH having a space by proper quoting, and not passing the directory name to dirname. Fixes atom/atom#4336 --- atom.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atom.sh b/atom.sh index 4a64ee40a..f35f5cfa6 100755 --- a/atom.sh +++ b/atom.sh @@ -45,12 +45,12 @@ if [ $REDIRECT_STDERR ]; then fi if [ $OS == 'Mac' ]; then - ATOM_PATH=${ATOM_PATH:-/Applications} # Set ATOM_PATH unless it is already set + ATOM_PATH="${ATOM_PATH:-/Applications}" # Set ATOM_PATH unless it is already set ATOM_APP_NAME=Atom.app # If ATOM_PATH isn't a executable file, use spotlight to search for Atom if [ ! -x "$ATOM_PATH/$ATOM_APP_NAME" ]; then - ATOM_PATH=$(mdfind "kMDItemCFBundleIdentifier == 'com.github.atom'" | grep -v ShipIt | head -1 | xargs dirname) + ATOM_PATH="$(mdfind "kMDItemCFBundleIdentifier == 'com.github.atom'" | grep -v ShipIt | sed '{s#/[^/]*$##; q; }')" fi # Exit if Atom can't be found From eb6ce74a12bd1a034765317ae88fa746b32b177c Mon Sep 17 00:00:00 2001 From: Paul Wagland Date: Fri, 5 Dec 2014 23:51:35 +0100 Subject: [PATCH 2/2] Use xargs -0 instead of sed, as this is easier to understand. Fixed atom/atom#4337 Fixes atom/atom#4336 --- atom.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom.sh b/atom.sh index f35f5cfa6..4c24692ec 100755 --- a/atom.sh +++ b/atom.sh @@ -50,7 +50,7 @@ if [ $OS == 'Mac' ]; then # If ATOM_PATH isn't a executable file, use spotlight to search for Atom if [ ! -x "$ATOM_PATH/$ATOM_APP_NAME" ]; then - ATOM_PATH="$(mdfind "kMDItemCFBundleIdentifier == 'com.github.atom'" | grep -v ShipIt | sed '{s#/[^/]*$##; q; }')" + ATOM_PATH="$(mdfind "kMDItemCFBundleIdentifier == 'com.github.atom'" | grep -v ShipIt | head -1 | xargs -0 dirname)" fi # Exit if Atom can't be found