Create Fasd cache file in user home directory

If oh-my-zsh is installed globally, ZSH_CACHE_DIR  may point to a directory which is not writable by the user or which is shared amog all the users. For example, in Arch Linux, it is pointing to /usr/share/oh-my-zsh.

This fix will create Fasd cache file as hidden in his home directory.
This commit is contained in:
Egidio Caprino 2017-07-06 19:18:05 +01:00
parent d848c94804
commit 6ae5684f46

View File

@ -1,5 +1,5 @@
if [ $commands[fasd] ]; then # check if fasd is installed if [ $commands[fasd] ]; then # check if fasd is installed
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache" fasd_cache="~/.fasd-init-cache"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
fasd --init auto >| "$fasd_cache" fasd --init auto >| "$fasd_cache"
fi fi