]> arthur.barton.de Git - ax-zsh.git/commitdiff
40_path: Update logic, add more search paths
authorAlexander Barton <alex@barton.de>
Sun, 19 Jul 2015 12:25:10 +0000 (14:25 +0200)
committerAlexander Barton <alex@barton.de>
Sun, 19 Jul 2015 12:25:10 +0000 (14:25 +0200)
Don't call "path_helper" at the end, because it reorders the PATH components
which leads to unpredictable results on OS X.

And add some more optional search paths, like Alex' "ConfigScripts" does.

core/40_path/40_path.zprofile

index 4421f80ce0f3779767d2145067474ac670c4e690..8f0a9f2a6ea31054539f4fa90db07308be7b0f54 100644 (file)
@@ -2,28 +2,41 @@
 # 40_path.zprofile: Setup PATH environment
 
 # Set default PATH
-export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
+if [[ -x /usr/libexec/path_helper ]]; then
+       eval "$(/usr/libexec/path_helper)"
+else
+       PATH="/usr/bin:/bin:/usr/sbin:/sbin"
+fi
+typeset -Ux PATH
 
 # Prepend additional search paths
-for d (/usr/local/bin /usr/local/sbin ~/Applications(N)); do
+for d (
+       /Developer/usr/bin
+       /usr/ucb
+       /usr/pkg/bin
+       /usr/local/bin
+       /usr/local/sbin
+       /opt/*/sbin(N)
+       /opt/*/bin(N)
+       ~/Applications(N)
+); do
        [ -d "$d" ] && path=("$d" $path)
 done
 
 # Append additional search paths
-for d (/opt/*/sbin /opt/*/bin(N)); do
+for d (
+       /usr/X11/bin
+       /usr/games
+); do
        [ -d "$d" ] && path=($path "$d")
 done
 
 # Set default MANPATH
-export MANPATH="$(manpath -q)" 2>/dev/null
+MANPATH="$(manpath -q)" 2>/dev/null
 if [[ $? -ne 0 ]]; then
        MANPATH="/usr/share/man"
        for d (/usr/local/share/man /opt/*/man(N)); do
                [ -d "$d" ] && manpath=($manpath "$d")
        done
 fi
-
-if [[ -x /usr/libexec/path_helper ]]; then
-       # Update PATH using "path_helper(1)", when available
-       eval "$(/usr/libexec/path_helper)"
-fi
+typeset -Ux MANPATH