From dbbae5752ba9da2af87e51408bc5f318af24c024 Mon Sep 17 00:00:00 2001 From: Daniel Barber Date: Wed, 17 Jul 2019 10:05:54 -0400 Subject: [PATCH] `brew --prefix` will return something whether ASDF is installed or not So we should check that the file exists before we try calling it. --- zsh/configs/post/path.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zsh/configs/post/path.zsh b/zsh/configs/post/path.zsh index 2730d8b..575af42 100644 --- a/zsh/configs/post/path.zsh +++ b/zsh/configs/post/path.zsh @@ -1,12 +1,16 @@ # ensure dotfiles bin directory is loaded first 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 . "$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 . "/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" fi