--- a/src/Pure/System/cygwin_init.scala Thu Sep 05 16:39:01 2013 +0200
+++ b/src/Pure/System/cygwin_init.scala Thu Sep 05 20:19:22 2013 +0200
@@ -7,7 +7,6 @@
package isabelle
-import java.lang.System
import java.io.{File => JFile, BufferedReader, InputStreamReader}
import java.nio.file.{Paths, Files}
import java.awt.{GraphicsEnvironment, Point, Font}
@@ -21,33 +20,9 @@
object Cygwin_Init
{
- /* command-line entry point */
-
- def main(args: Array[String]) =
- {
- GUI.init_laf()
- try {
- require(Platform.is_windows)
-
- val isabelle_home = System.getProperty("isabelle.home")
- if (isabelle_home == null || isabelle_home == "")
- error("Unknown Isabelle home directory")
- if (!(new JFile(isabelle_home)).isDirectory)
- error("Bad Isabelle home directory: " + quote(isabelle_home))
+ /* main GUI entry point */
- Swing_Thread.later { main_frame(isabelle_home) }
- }
- catch {
- case exn: Throwable =>
- GUI.error_dialog(null, "Isabelle init failure", GUI.scrollable_text(Exn.message(exn)))
- sys.exit(2)
- }
- }
-
-
- /* main window */
-
- private def main_frame(isabelle_home: String) = new MainFrame
+ def main_frame(isabelle_home: String, start: => Unit) = new MainFrame
{
title = "Isabelle system initialization"
iconImage = new ImageIcon(isabelle_home + "\\lib\\logo\\isabelle.gif").getImage
@@ -73,7 +48,14 @@
/* exit button */
var _return_code: Option[Int] = None
- def maybe_exit(): Unit = _return_code.foreach(sys.exit(_))
+ def maybe_exit()
+ {
+ _return_code match {
+ case None =>
+ case Some(0) => start
+ case Some(rc) => sys.exit(rc)
+ }
+ }
def return_code(rc: Int): Unit =
Swing_Thread.later {
@@ -102,7 +84,7 @@
default_thread_pool.submit(() =>
try {
- init(isabelle_home, echo)
+ init_filesystem(isabelle_home, echo)
return_code(0)
}
catch {
@@ -116,13 +98,8 @@
/* init Cygwin file-system */
- private def init(isabelle_home: String, echo: String => Unit)
+ private def init_filesystem(isabelle_home: String, echo: String => Unit)
{
- val cygwin_root = isabelle_home + "\\contrib\\cygwin"
-
- if (!(new JFile(cygwin_root)).isDirectory)
- error("Bad Isabelle Cygwin directory: " + quote(cygwin_root))
-
def execute(args: String*): Int =
{
val cwd = new JFile(isabelle_home)
@@ -148,7 +125,7 @@
echo("symlinks ...")
val symlinks =
{
- val path = (new JFile(cygwin_root, "isabelle\\symlinks")).toPath
+ val path = (new JFile("contrib\\cygwin\\isabelle\\symlinks")).toPath
Files.readAllLines(path, UTF8.charset).toArray.toList.asInstanceOf[List[String]]
}
@tailrec def recover_symlinks(list: List[String]): Unit =
@@ -171,13 +148,12 @@
recover_symlinks(symlinks)
echo("rebaseall ...")
- execute(cygwin_root + "\\bin\\dash.exe", "/isabelle/rebaseall")
+ execute("contrib\\cygwin\\bin\\dash.exe", "/isabelle/rebaseall")
echo("postinstall ...")
- execute(cygwin_root + "\\bin\\bash.exe", "/isabelle/postinstall")
+ execute("contrib\\cygwin\\bin\\bash.exe", "/isabelle/postinstall")
echo("init ...")
- System.setProperty("cygwin.root", cygwin_root)
Isabelle_System.init()
echo("OK")
}