src/Pure/System/isabelle_env.scala
changeset 73902 4df63c3a4c4f
parent 73901 bf476aed616d
child 73903 9849943b83fa
equal deleted inserted replaced
73901:bf476aed616d 73902:4df63c3a4c4f
    17 
    17 
    18 
    18 
    19 object Isabelle_Env
    19 object Isabelle_Env
    20 {
    20 {
    21   /** bootstrap information **/
    21   /** bootstrap information **/
    22 
       
    23   def jdk_home(): String =
       
    24   {
       
    25     val java_home = System.getProperty("java.home", "")
       
    26     val home = new JFile(java_home)
       
    27     val parent = home.getParent
       
    28     if (home.getName == "jre" && parent != null &&
       
    29         (new JFile(new JFile(parent, "bin"), "javac")).exists) parent
       
    30     else java_home
       
    31   }
       
    32 
    22 
    33   def bootstrap_directory(
    23   def bootstrap_directory(
    34     preference: String, envar: String, property: String, description: String): String =
    24     preference: String, envar: String, property: String, description: String): String =
    35   {
    25   {
    36     val value =
    26     val value =
   245       env_default("TEMP_WINDOWS",
   235       env_default("TEMP_WINDOWS",
   246         {
   236         {
   247           val temp = if (Platform.is_windows) System.getenv("TEMP") else null
   237           val temp = if (Platform.is_windows) System.getenv("TEMP") else null
   248           if (temp != null && temp.contains('\\')) temp else ""
   238           if (temp != null && temp.contains('\\')) temp else ""
   249         })
   239         })
   250       env_default("ISABELLE_JDK_HOME", standard_path(cygwin_root, jdk_home()))
   240       env_default("ISABELLE_JDK_HOME",
       
   241         standard_path(cygwin_root, System.getProperty("java.home", "")))
   251       env_default("HOME", System.getProperty("user.home", ""))
   242       env_default("HOME", System.getProperty("user.home", ""))
   252       env_default("ISABELLE_APP", System.getProperty("isabelle.app", ""))
   243       env_default("ISABELLE_APP", System.getProperty("isabelle.app", ""))
   253 
   244 
   254       val settings = new HashMap[String, String]
   245       val settings = new HashMap[String, String]
   255       val settings_file = Files.createTempFile(null, null)
   246       val settings_file = Files.createTempFile(null, null)