From cff3454effbe323b287f95d29329b70adfa22979 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 14 Jan 1992 18:31:56 +0000 Subject: Use $TMPDIR if it is set in the environment. --- Lib/tempfile.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Lib/tempfile.py b/Lib/tempfile.py index a571f41..793c23f 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -5,11 +5,16 @@ import path # Changeable parameters (by clients!)... -# XXX Should the environment variable $TMPDIR override tempdir? tempdir = '/usr/tmp' template = '@' +# Use environment variable $TMPDIR to override default tempdir. + +if posix.environ.has_key('TMPDIR'): + # XXX Could check that it's a writable directory... + tempdir = posix.environ['TMPDIR'] + # Counter for generating unique names -- cgit v0.12