summaryrefslogtreecommitdiff
path: root/oh-my-zsh.sh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2021-09-27 13:03:58 -0600
committerTuowen Zhao <ztuowen@gmail.com>2021-09-27 13:03:58 -0600
commitc674485e6b4abe313469900997d893d2940ee843 (patch)
treed6ca6edaff3d81849489f31ca13b127acef89c75 /oh-my-zsh.sh
parent3c73976ef306d68a85d60c94be9a1dcdc33fa2bf (diff)
parent93ad3a88214b95f571e03c21f7d9bd76f9110938 (diff)
downloadzsh-c674485e6b4abe313469900997d893d2940ee843.tar.gz
zsh-c674485e6b4abe313469900997d893d2940ee843.tar.bz2
zsh-c674485e6b4abe313469900997d893d2940ee843.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'oh-my-zsh.sh')
-rw-r--r--oh-my-zsh.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index 16e244be5..545d980f0 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -7,6 +7,15 @@ if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache"
fi
+# Make sure $ZSH_CACHE_DIR is writable, otherwise use a directory in $HOME
+if [[ ! -w "$ZSH_CACHE_DIR" ]]; then
+ ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh"
+fi
+
+# Create cache and completions dir and add to $fpath
+mkdir -p "$ZSH_CACHE_DIR/completions"
+(( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
+
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
source $ZSH/tools/check_for_upgrade.sh