瀏覽代碼

Added some error-checking to ghc-wrapper

Getty Ritter 8 年之前
父節點
當前提交
7f102d77c5
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      scripts/ghc-wrapper

+ 8 - 0
scripts/ghc-wrapper

@@ -80,6 +80,14 @@ WARNING: This script is quite brittle and makes a lot of assumptions about
 how you lay things out! While I suspect it shouldn't actively break anything,
 be careful about using it!
 EOF
+elif [ ! -e ~/.current-ghc ]; then
+    # we haven't run this script before and don't have a .current-ghc, and
+    # we rely on having a binary _somewhere_, so let's use a default one
+    exec /usr/bin/ghc "$@"
+elif [ ! -e /home/gdritter/install/$(cat ~/.current-ghc)/bin/$(basename $0) ]; then
+    # we HAVE a .current-ghc but it doesn't exist, so let's also default to
+    # the one in /usr/bin
+    exec /usr/bin/ghc "$@"
 else
    exec /home/gdritter/install/$(cat ~/.current-ghc)/bin/$(basename $0) "$@"
 fi