more robust Cygwin.config: actually check Wow6432Node, prefer explicit CYGWIN_ROOT in any case;
authorwenzelm
Wed Dec 09 16:28:49 2009 +0100 (2009-12-09)
changeset 340437129fab1fe4f
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
     1.1 --- a/lib/scripts/getsettings	Wed Dec 09 12:26:42 2009 +0100
     1.2 +++ b/lib/scripts/getsettings	Wed Dec 09 16:28:49 2009 +0100
     1.3 @@ -51,6 +51,7 @@
     1.4  if [ "$OSTYPE" = cygwin ]; then
     1.5    CLASSPATH="$(cygpath -u -p "$CLASSPATH")"
     1.6    function jvmpath() { cygpath -w -p "$@"; }
     1.7 +  CYGWIN_ROOT="$(jvmpath "/")"
     1.8  else
     1.9    function jvmpath() { echo "$@"; }
    1.10  fi
     2.1 --- a/src/Pure/System/cygwin.scala	Wed Dec 09 12:26:42 2009 +0100
     2.2 +++ b/src/Pure/System/cygwin.scala	Wed Dec 09 16:28:49 2009 +0100
     2.3 @@ -81,11 +81,16 @@
     2.4  
     2.5    // new-style setup (Cygwin 1.7)
     2.6    private val CYGWIN_SETUP1 = "Software\\Cygwin\\setup"
     2.7 -  private val CYGWIN_SETUP2 = "Software\\Wow6432Node\\Cygwin\\setup"  // !?
     2.8 +  private val CYGWIN_SETUP2 = "Software\\Wow6432Node\\Cygwin\\setup"
     2.9  
    2.10    def config(): (String, String) =
    2.11    {
    2.12 -    query_registry(CYGWIN_SETUP1, "rootdir") match {
    2.13 +    val cygwin_root = java.lang.System.getenv("CYGWIN_ROOT")
    2.14 +
    2.15 +    (if (cygwin_root != null && cygwin_root != "") Some(cygwin_root) else None) orElse
    2.16 +    query_registry(CYGWIN_SETUP1, "rootdir") orElse
    2.17 +      query_registry(CYGWIN_SETUP2, "rootdir") match
    2.18 +    {
    2.19        case Some(root) => (root, "/cygdrive")
    2.20        case None =>
    2.21          val root =