From b7fb0a55c03429bd90cbae74fb538bb0dff4b0ea Mon Sep 17 00:00:00 2001 From: smac89 <8305511+smac89@users.noreply.github.com> Date: Fri, 17 Dec 2021 06:45:06 -0600 Subject: [PATCH] fix(heroku): fix XDG cache directory name and code style (#10436) --- plugins/heroku/heroku.plugin.zsh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/heroku/heroku.plugin.zsh b/plugins/heroku/heroku.plugin.zsh index 9a99b4211..d22c1bb2f 100644 --- a/plugins/heroku/heroku.plugin.zsh +++ b/plugins/heroku/heroku.plugin.zsh @@ -1,9 +1,9 @@ -HEROKU_AC_CACHE_DIR="$HOME/.cache" -if [ "$(uname -s)" = "Darwin" ]; then - HEROKU_AC_CACHE_DIR="$HOME/Library/Caches" +if [[ "$OSTYPE" = darwin* ]]; then + cache_dir="${HOME}/Library/Caches" +else + cache_dir="${XDG_CACHE_HOME:-"${HOME}/.cache"}" fi -if [ ! -z "$XDG_CACHE_HOME" ]; then - HEROKU_AC_CACHE_DIR="$XDG_CACHE_DIR" -fi -HEROKU_AC_ZSH_SETUP_PATH=$HEROKU_AC_CACHE_DIR/heroku/autocomplete/zsh_setup -[ -f $HEROKU_AC_ZSH_SETUP_PATH ] && source $HEROKU_AC_ZSH_SETUP_PATH + +setup_path="${cache_dir}/heroku/autocomplete/zsh_setup" +[[ -f "$setup_path" ]] && source $setup_path +unset cache_dir setup_path