simplified Cygwin setup, assuming 1.7 registry layout (version 1.5 suffers from upcaseenv problem anyway);
--- a/src/Pure/System/cygwin.scala Wed Dec 09 21:25:07 2009 +0100
+++ b/src/Pure/System/cygwin.scala Wed Dec 09 21:55:14 2009 +0100
@@ -76,36 +76,23 @@
/* Cygwin installation */
- // old-style mount points (Cygwin 1.5)
- private val CYGWIN_MOUNTS = "Software\\Cygnus Solutions\\Cygwin\\mounts v2"
-
- // new-style setup (Cygwin 1.7)
private val CYGWIN_SETUP1 = "Software\\Cygwin\\setup"
private val CYGWIN_SETUP2 = "Software\\Wow6432Node\\Cygwin\\setup"
- def config(): (String, String) =
+ def check_root(): String =
{
- 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 =
- query_registry(CYGWIN_MOUNTS + "\\/", "native") getOrElse "C:\\cygwin"
- val cygdrive =
- query_registry(CYGWIN_MOUNTS, "cygdrive prefix") getOrElse "cygdrive"
- (root, cygdrive)
- }
+ val root_env = java.lang.System.getenv("CYGWIN_ROOT")
+ val root =
+ if (root_env != null && root_env != "") root_env
+ else
+ query_registry(CYGWIN_SETUP1, "rootdir") orElse
+ query_registry(CYGWIN_SETUP2, "rootdir") getOrElse
+ error("Failed to determine Cygwin installation -- version 1.7 required")
+ val ok =
+ new File(root + "\\bin\\bash.exe").isFile &&
+ new File(root + "\\bin\\env.exe").isFile
+ if (!ok) error("Bad Cygwin installation: " + root)
+ root
}
-
-
- /* basic sanity check */
-
- def check(root: String): Boolean =
- new File(root + "\\bin\\bash.exe").isFile &&
- new File(root + "\\bin\\env.exe").isFile
}
--- a/src/Pure/System/gui_setup.scala Wed Dec 09 21:25:07 2009 +0100
+++ b/src/Pure/System/gui_setup.scala Wed Dec 09 21:55:14 2009 +0100
@@ -51,7 +51,7 @@
text.append("Alternative platform: " + name2 + "\n")
}
if (Platform.is_windows) {
- text.append("Cygwin root: " + Cygwin.config()._1 + "\n")
+ text.append("Cygwin root: " + Cygwin.check_root() + "\n")
}
try {
val isabelle_system = new Isabelle_System
--- a/src/Pure/System/isabelle_system.scala Wed Dec 09 21:25:07 2009 +0100
+++ b/src/Pure/System/isabelle_system.scala Wed Dec 09 21:55:14 2009 +0100
@@ -62,8 +62,8 @@
private val (platform_root, drive_prefix, shell_prefix) =
{
if (Platform.is_windows) {
- val (root, drive) = Cygwin.config()
- if (!Cygwin.check(root)) error("Bad Cygwin installation: " + root)
+ val root = Cygwin.check_root()
+ val drive = "/cygdrive"
val shell = List(root + "\\bin\\bash", "-l")
(root, drive, shell)
}