src/Pure/System/isabelle_system.scala
changeset 58640 37f852399a32
parent 57411 9444489766a1
child 60013 42d34eeb283c
     1.1 --- a/src/Pure/System/isabelle_system.scala	Thu Oct 09 11:15:03 2014 +0200
     1.2 +++ b/src/Pure/System/isabelle_system.scala	Thu Oct 09 13:56:27 2014 +0200
     1.3 @@ -76,20 +76,26 @@
     1.4  
     1.5        set_cygwin_root()
     1.6  
     1.7 +      def default(env: Map[String, String], entry: (String, String)): Map[String, String] =
     1.8 +        if (env.isDefinedAt(entry._1) || entry._2 == "") env
     1.9 +        else env + entry
    1.10 +
    1.11        val env =
    1.12        {
    1.13 +        val temp_windows =
    1.14 +        {
    1.15 +          val temp = System.getenv("TEMP")
    1.16 +          if (temp != null && temp.contains('\\')) temp else ""
    1.17 +        }
    1.18          val user_home = System.getProperty("user.home", "")
    1.19          val isabelle_app = System.getProperty("isabelle.app", "")
    1.20  
    1.21 -        val env0 = sys.env + ("ISABELLE_JDK_HOME" -> posix_path(jdk_home()))
    1.22 -        val env1 =
    1.23 -          if (user_home == "" || env0.isDefinedAt("HOME")) env0
    1.24 -          else env0 + ("HOME" -> user_home)
    1.25 -        val env2 =
    1.26 -          if (isabelle_app == "") env1
    1.27 -          else env1 + ("ISABELLE_APP" -> "true")
    1.28 -
    1.29 -        env2
    1.30 +        default(
    1.31 +          default(
    1.32 +            default(sys.env + ("ISABELLE_JDK_HOME" -> posix_path(jdk_home())),
    1.33 +              ("TEMP_WINDOWS" -> temp_windows)),
    1.34 +            ("HOME" -> user_home)),
    1.35 +          ("ISABELLE_APP" -> "true"))
    1.36        }
    1.37  
    1.38        val system_home =