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, 09 Oct 2014 13:56:27 +0200
changeset 58640 37f852399a32
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
--- a/Admin/Windows/Cygwin/Cygwin-Terminal.bat	Thu Oct 09 11:15:03 2014 +0200
+++ b/Admin/Windows/Cygwin/Cygwin-Terminal.bat	Thu Oct 09 13:56:27 2014 +0200
@@ -1,5 +1,6 @@
 @echo off
 
+set TEMP_WINDOWS=%TEMP%
 set HOME=%HOMEDRIVE%%HOMEPATH%
 set PATH=%CD%\bin;%PATH%
 set CHERE_INVOKING=true
--- a/lib/scripts/getsettings	Thu Oct 09 11:15:03 2014 +0200
+++ b/lib/scripts/getsettings	Thu Oct 09 13:56:27 2014 +0200
@@ -26,6 +26,12 @@
 then
   unset INI_DIR
 
+  if [ -n "$TEMP_WINDOWS" ]; then
+    TMPDIR="$(cygpath -u "$TEMP_WINDOWS")"
+    TMP="$TMPDIR"
+    TEMP="$TMPDIR"
+  fi
+
   if [ -z "$USER_HOME" ]; then
     USER_HOME="$(cygpath -u "$HOMEDRIVE\\$HOMEPATH")"
   fi
--- a/src/Pure/System/isabelle_system.scala	Thu Oct 09 11:15:03 2014 +0200
+++ b/src/Pure/System/isabelle_system.scala	Thu Oct 09 13:56:27 2014 +0200
@@ -76,20 +76,26 @@
 
       set_cygwin_root()
 
+      def default(env: Map[String, String], entry: (String, String)): Map[String, String] =
+        if (env.isDefinedAt(entry._1) || entry._2 == "") env
+        else env + entry
+
       val env =
       {
+        val temp_windows =
+        {
+          val temp = System.getenv("TEMP")
+          if (temp != null && temp.contains('\\')) temp else ""
+        }
         val user_home = System.getProperty("user.home", "")
         val isabelle_app = System.getProperty("isabelle.app", "")
 
-        val env0 = sys.env + ("ISABELLE_JDK_HOME" -> posix_path(jdk_home()))
-        val env1 =
-          if (user_home == "" || env0.isDefinedAt("HOME")) env0
-          else env0 + ("HOME" -> user_home)
-        val env2 =
-          if (isabelle_app == "") env1
-          else env1 + ("ISABELLE_APP" -> "true")
-
-        env2
+        default(
+          default(
+            default(sys.env + ("ISABELLE_JDK_HOME" -> posix_path(jdk_home())),
+              ("TEMP_WINDOWS" -> temp_windows)),
+            ("HOME" -> user_home)),
+          ("ISABELLE_APP" -> "true"))
       }
 
       val system_home =