Mailspring/N1.sh
mbilker 887db8d8ea fix(launch): convert Atom's launch script for N1
Addresses #411

The `N1.sh` launch script fails to account for running from
`/usr/{local/}bin/nylas` where it would throw an error saying
it couldn't find the electron binary.

The Atom launch script works just fine and takes that into account.
The installed launch script here is a reflactored Atom launch script
that properly accounts for running the `nylas` executable and locates
the actual binary accordingly.
2016-03-02 17:47:47 -08:00

24 lines
834 B
Bash
Executable file

#!/bin/bash
N1_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd );
if [ "$(uname)" == 'Darwin' ]; then
ELECTRON_PATH=${ELECTRON_PATH:-$N1_PATH/electron/Electron.app/Contents/MacOS/Electron}
elif [ "$(expr substr $(uname -s) 1 5)" == 'Linux' ]; then
ELECTRON_PATH=${ELECTRON_PATH:-$N1_PATH/electron/electron}
mkdir -p "$HOME/.nylas"
elif [ "$(expr substr $(uname -s) 1 10)" == 'MINGW32_NT' ]; then
ELECTRON_PATH=${ELECTRON_PATH:-$N1_PATH/electron/electron.exe}
else
echo "Your platform ($(uname -a)) is not supported."
exit 1
fi
if [ ! -e "$ELECTRON_PATH" ]; then
echo "Can't find the Electron executable at $ELECTRON_PATH. Be sure you have run script/bootstrap first from $N1_PATH or set the ELECTRON_PATH environment variable."
exit 1
fi
$ELECTRON_PATH --executed-from="$(pwd)" --pid=$$ $N1_PATH "$@"
exit $?