From 948d9b3aa51f9bbf320649801565dc9164181e5c Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Fri, 10 Nov 2017 11:37:11 -0800 Subject: [PATCH] Store cache files in a user-writable location Fixes #1122 --- modules/fasd/init.zsh | 2 +- modules/node/init.zsh | 2 +- modules/perl/init.zsh | 2 +- modules/python/init.zsh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/fasd/init.zsh b/modules/fasd/init.zsh index 44d6297..113a871 100644 --- a/modules/fasd/init.zsh +++ b/modules/fasd/init.zsh @@ -19,7 +19,7 @@ fi # Initialization # -cache_file="${0:h}/cache.zsh" +cache_file="${TMPDIR:-/tmp}/prezto-fasd-cache.$UID.zsh" if [[ "${commands[fasd]}" -nt "$cache_file" || ! -s "$cache_file" ]]; then # Set the base init arguments. init_args=(zsh-hook) diff --git a/modules/node/init.zsh b/modules/node/init.zsh index 127dea7..578c642 100644 --- a/modules/node/init.zsh +++ b/modules/node/init.zsh @@ -30,7 +30,7 @@ fi # Load NPM completion. if (( $+commands[npm] )); then - cache_file="${0:h}/cache.zsh" + cache_file="${TMPDIR:-/tmp}/prezto-node-cache.$UID.zsh" if [[ "$commands[npm]" -nt "$cache_file" || ! -s "$cache_file" ]]; then # npm is slow; cache its output. diff --git a/modules/perl/init.zsh b/modules/perl/init.zsh index 1624fbf..ffd5f0d 100644 --- a/modules/perl/init.zsh +++ b/modules/perl/init.zsh @@ -39,7 +39,7 @@ fi if [[ "$OSTYPE" == darwin* ]]; then # Perl is slow; cache its output. - cache_file="${0:h}/cache.zsh" + cache_file="${TMPDIR:-/tmp}/prezto-perl-cache.$UID.zsh" perl_path="$HOME/Library/Perl/5.12" if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 6f8ae7f..7aad597 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -129,7 +129,7 @@ fi # Load PIP completion. if (( $#commands[(i)pip(|[23])] )); then - cache_file="${0:h}/cache.zsh" + cache_file="${TMPDIR:-/tmp}/prezto-python-cache.$UID.zsh" # Detect and use one available from among 'pip', 'pip2', 'pip3' variants pip_command="$commands[(i)pip(|[23])]"