Commits

Juha Komulainen  committed 6a1aa7d

Loop over path candidates instead of hardcoding them specially.

  • Participants
  • Parent commits adfee9d

Comments (0)

Files changed (1)

 
 BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 
-if [ -d ~/bin ]; then
-    export PATH=$PATH:~/bin
-fi
+PATH_CANDIDATES="$HOME/bin:$BASEDIR/bin:$BASEDIR/3bin:$HOME/Library/Haskell/bin"
 
-if [ -d $BASEDIR/bin ]; then
-    export PATH=$PATH:$BASEDIR/bin
-fi
+for dir in ${PATH_CANDIDATES//:/ }; do
+    if [ -d $dir ]; then
+	PATH=$PATH:$dir
+    fi
+done
 
-if [ -d $BASEDIR/3bin ]; then
-    export PATH=$PATH:$BASEDIR/3bin
-fi
-
-# Add packages installed by Cabal to path
-if [ -d ~/Library/Haskell/bin ]; then
-    export PATH=$PATH:~/Library/Haskell/bin
-fi
+export PATH
 
 # TODO: better detection of GNU ls
 KERNEL=$(uname)