# HG changeset patch # User wenzelm # Date 1274379720 -7200 # Node ID 641923374eba0b6f8a2c23d2536c2c8146524952 # Parent 106c56e916f8ce07c5511d19da446dda9cbff6ca Isabelle_System: allow explicit isabelle_home argument; diff -r 106c56e916f8 -r 641923374eba 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 =