[Jython-checkins] jython: Correct temporary directory search path on Windows.

jeff.allen jython-checkins at python.org
Thu Apr 9 09:28:36 CEST 2015


https://hg.python.org/jython/rev/1dff925eb167
changeset:   7651:1dff925eb167
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Mon Apr 06 18:49:50 2015 +0100
summary:
  Correct temporary directory search path on Windows.

Replace spurious Unix-like paths added when os.name=='java', with the
ones appropriate to 'nt'. Affects riscos correspondingly, which seems
right, but is untested.

files:
  Lib/tempfile.py |  10 ++++++++--
  1 files changed, 8 insertions(+), 2 deletions(-)


diff --git a/Lib/tempfile.py b/Lib/tempfile.py
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -160,11 +160,17 @@
         dirname = _os.getenv(envname)
         if dirname: dirlist.append(dirname)
 
+    # Real name of OS
+    if _os.name != 'java':
+        os_name = _os.name
+    else:
+        os_name = _os._name
+
     # Failing that, try OS-specific locations.
-    if _os.name == 'riscos':
+    if os_name == 'riscos':
         dirname = _os.getenv('Wimp$ScrapDir')
         if dirname: dirlist.append(dirname)
-    elif _os.name == 'nt':
+    elif os_name == "nt":
         dirlist.extend([ r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ])
     else:
         dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ])

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list