"1_local": Update PATH to include directories inside of $HOME
[OhMyZshExtensions.git] / plugins / 1_local / 1_local.plugin.zsh
1 # 1_local.plugin.zsh
2 # 2015-03-27, alex@barton.de
3
4 [ -d "/usr/local/home" -a ! -d "/usr/local/home/$LOGNAME" ] \
5         && mkdir "/usr/local/home/$LOGNAME" >/dev/null 2>&1
6
7 [ -w "/usr/local/home/$LOGNAME" ] \
8         && export LOCAL_HOME="/usr/local/home/$LOGNAME" \
9         || export LOCAL_HOME="$HOME"
10
11 # Setup XDG cache directory
12 export XDG_CACHE_HOME="$LOCAL_HOME/.cache"
13
14 # Update PATH to include directories inside of the $HOME directory
15 typeset -U path
16 for d in ~/bin ~/sbin ~/Applications; do
17         [ -d "$d" ] && path[1,0]="$d"
18 done