prefer original TEMP from Windows, e.g. relevant for Isabelle distribution within read-only directory (due to its bundled Cygwin and /tmp inside of it);
authorwenzelm
Thu Oct 09 13:56:27 2014 +0200 (2014-10-09)
changeset 5864037f852399a32
parent 58639 1df53737c59b
child 58641 5697ae9a683a
prefer original TEMP from Windows, e.g. relevant for Isabelle distribution within read-only directory (due to its bundled Cygwin and /tmp inside of it);
Admin/Windows/Cygwin/Cygwin-Terminal.bat
lib/scripts/getsettings
src/Pure/System/isabelle_system.scala
     1.1 --- a/Admin/Windows/Cygwin/Cygwin-Terminal.bat	Thu Oct 09 11:15:03 2014 +0200
     1.2 +++ b/Admin/Windows/Cygwin/Cygwin-Terminal.bat	Thu Oct 09 13:56:27 2014 +0200
     1.3 @@ -1,5 +1,6 @@
     1.4  @echo off
     1.5  
     1.6 +set TEMP_WINDOWS=%TEMP%
     1.7  set HOME=%HOMEDRIVE%%HOMEPATH%
     1.8  set PATH=%CD%\bin;%PATH%
     1.9  set CHERE_INVOKING=true
     2.1 --- a/lib/scripts/getsettings	Thu Oct 09 11:15:03 2014 +0200
     2.2 +++ b/lib/scripts/getsettings	Thu Oct 09 13:56:27 2014 +0200
     2.3 @@ -26,6 +26,12 @@
     2.4  then
     2.5    unset INI_DIR
     2.6  
     2.7 +  if [ -n "$TEMP_WINDOWS" ]; then
     2.8 +    TMPDIR="$(cygpath -u "$TEMP_WINDOWS")"
     2.9 +    TMP="$TMPDIR"
    2.10 +    TEMP="$TMPDIR"
    2.11 +  fi
    2.12 +
    2.13    if [ -z "$USER_HOME" ]; then
    2.14      USER_HOME="$(cygpath -u "$HOMEDRIVE\\$HOMEPATH")"
    2.15    fi
     3.1 --- a/src/Pure/System/isabelle_system.scala	Thu Oct 09 11:15:03 2014 +0200
     3.2 +++ b/src/Pure/System/isabelle_system.scala	Thu Oct 09 13:56:27 2014 +0200
     3.3 @@ -76,20 +76,26 @@
     3.4  
     3.5        set_cygwin_root()
     3.6  
     3.7 +      def default(env: Map[String, String], entry: (String, String)): Map[String, String] =
     3.8 +        if (env.isDefinedAt(entry._1) || entry._2 == "") env
     3.9 +        else env + entry
    3.10 +
    3.11        val env =
    3.12        {
    3.13 +        val temp_windows =
    3.14 +        {
    3.15 +          val temp = System.getenv("TEMP")
    3.16 +          if (temp != null && temp.contains('\\')) temp else ""
    3.17 +        }
    3.18          val user_home = System.getProperty("user.home", "")
    3.19          val isabelle_app = System.getProperty("isabelle.app", "")
    3.20  
    3.21 -        val env0 = sys.env + ("ISABELLE_JDK_HOME" -> posix_path(jdk_home()))
    3.22 -        val env1 =
    3.23 -          if (user_home == "" || env0.isDefinedAt("HOME")) env0
    3.24 -          else env0 + ("HOME" -> user_home)
    3.25 -        val env2 =
    3.26 -          if (isabelle_app == "") env1
    3.27 -          else env1 + ("ISABELLE_APP" -> "true")
    3.28 -
    3.29 -        env2
    3.30 +        default(
    3.31 +          default(
    3.32 +            default(sys.env + ("ISABELLE_JDK_HOME" -> posix_path(jdk_home())),
    3.33 +              ("TEMP_WINDOWS" -> temp_windows)),
    3.34 +            ("HOME" -> user_home)),
    3.35 +          ("ISABELLE_APP" -> "true"))
    3.36        }
    3.37  
    3.38        val system_home =