more robust Cygwin.config: actually check Wow6432Node, prefer explicit CYGWIN_ROOT in any case;
authorwenzelm
Wed, 09 Dec 2009 16:28:49 +0100
changeset 34043 7129fab1fe4f
parent 34042 b174d384293e
child 34044 09afb1d49fe7
child 34050 3d2acb18f2f2
more robust Cygwin.config: actually check Wow6432Node, prefer explicit CYGWIN_ROOT in any case;
lib/scripts/getsettings
src/Pure/System/cygwin.scala
--- a/lib/scripts/getsettings	Wed Dec 09 12:26:42 2009 +0100
+++ b/lib/scripts/getsettings	Wed Dec 09 16:28:49 2009 +0100
@@ -51,6 +51,7 @@
 if [ "$OSTYPE" = cygwin ]; then
   CLASSPATH="$(cygpath -u -p "$CLASSPATH")"
   function jvmpath() { cygpath -w -p "$@"; }
+  CYGWIN_ROOT="$(jvmpath "/")"
 else
   function jvmpath() { echo "$@"; }
 fi
--- a/src/Pure/System/cygwin.scala	Wed Dec 09 12:26:42 2009 +0100
+++ b/src/Pure/System/cygwin.scala	Wed Dec 09 16:28:49 2009 +0100
@@ -81,11 +81,16 @@
 
   // new-style setup (Cygwin 1.7)
   private val CYGWIN_SETUP1 = "Software\\Cygwin\\setup"
-  private val CYGWIN_SETUP2 = "Software\\Wow6432Node\\Cygwin\\setup"  // !?
+  private val CYGWIN_SETUP2 = "Software\\Wow6432Node\\Cygwin\\setup"
 
   def config(): (String, String) =
   {
-    query_registry(CYGWIN_SETUP1, "rootdir") match {
+    val cygwin_root = java.lang.System.getenv("CYGWIN_ROOT")
+
+    (if (cygwin_root != null && cygwin_root != "") Some(cygwin_root) else None) orElse
+    query_registry(CYGWIN_SETUP1, "rootdir") orElse
+      query_registry(CYGWIN_SETUP2, "rootdir") match
+    {
       case Some(root) => (root, "/cygdrive")
       case None =>
         val root =