Isabelle_System: allow explicit isabelle_home argument;
authorwenzelm
Thu, 20 May 2010 20:22:00 +0200
changeset 37013 641923374eba
parent 37012 106c56e916f8
child 37014 1af0f718ffdc
Isabelle_System: allow explicit isabelle_home argument;
src/Pure/System/isabelle_system.scala
--- a/src/Pure/System/isabelle_system.scala	Thu May 20 20:20:52 2010 +0200
+++ b/src/Pure/System/isabelle_system.scala	Thu May 20 20:22:00 2010 +0200
@@ -18,10 +18,20 @@
 import scala.collection.mutable
 
 
-class Isabelle_System extends Standard_System
+class Isabelle_System(this_isabelle_home: String) extends Standard_System
 {
+  def this() = this(null)
+
+
   /** Isabelle environment **/
 
+  /*
+    isabelle_home precedence:
+      (1) this_isabelle_home as explicit argument
+      (2) ISABELLE_HOME process environment variable (e.g. inherited from running isabelle tool)
+      (3) isabelle.home system property (e.g. via JVM application boot process)
+  */
+
   private val environment: Map[String, String] =
   {
     import scala.collection.JavaConversions._
@@ -30,13 +40,15 @@
       ("THIS_JAVA" -> this_java())
 
     val isabelle_home =
-      env0.get("ISABELLE_HOME") match {
-        case None | Some("") =>
-          val path = java.lang.System.getProperty("isabelle.home")
-          if (path == null || path == "") error("Unknown Isabelle home directory")
-          else path
-        case Some(path) => path
-      }
+      if (this_isabelle_home != null) this_isabelle_home
+      else
+        env0.get("ISABELLE_HOME") match {
+          case None | Some("") =>
+            val path = java.lang.System.getProperty("isabelle.home")
+            if (path == null || path == "") error("Unknown Isabelle home directory")
+            else path
+          case Some(path) => path
+        }
 
     Standard_System.with_tmp_file("settings") { dump =>
         val shell_prefix =