brew --prefix will return something whether ASDF is installed or not

So we should check that the file exists before we try calling it.
This commit is contained in:
Daniel Barber 2019-07-17 10:05:54 -04:00 committed by Daniel Barber
parent cdd0d2ced8
commit dbbae5752b

View file

@ -1,12 +1,16 @@
# ensure dotfiles bin directory is loaded first # ensure dotfiles bin directory is loaded first
PATH="$HOME/.bin:/usr/local/sbin:$PATH" PATH="$HOME/.bin:/usr/local/sbin:$PATH"
# load ASDF, either from home dir or brew install # Try loading ASDF from the regular home dir location
if [ -f "$HOME/.asdf/asdf.sh" ]; then if [ -f "$HOME/.asdf/asdf.sh" ]; then
. "$HOME/.asdf/asdf.sh" . "$HOME/.asdf/asdf.sh"
# It's not in the home dir, let's try the default Homebrew location
elif [ -f "/usr/local/opt/asdf/asdf.sh" ]; then elif [ -f "/usr/local/opt/asdf/asdf.sh" ]; then
. "/usr/local/opt/asdf/asdf.sh" . "/usr/local/opt/asdf/asdf.sh"
elif which brew >/dev/null && ASDF_PREFIX=$(brew --prefix asdf); then # Not there either! Last try, let's see if Homebrew can tell us where it is
elif which brew >/dev/null &&
ASDF_PREFIX=$(brew --prefix asdf) &&
[ -f "$ASDF_PREFIX/asdf.sh" ]; then
. "$ASDF_PREFIX/asdf.sh" . "$ASDF_PREFIX/asdf.sh"
fi fi