summaryrefslogtreecommitdiff
path: root/lib/tempfile.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-21 15:34:18 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-21 15:34:18 +0000
commit24162714051692617fe25fda7e88c58e25013c97 (patch)
tree619799712c383752f7cd302906684a9c0856203e /lib/tempfile.rb
parent15c3df744f228f3d967ca624533d17f491555e93 (diff)
* lib/tmpdir.rb: new library to get temporary directory path,
using GetTempPath on Win32 environment. * lib/tempfile.rb: now uses tmpdir.rb. * lib/cgi/session.rb, ib/drb/unix.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r--lib/tempfile.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index b122795..baaac8f 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -5,6 +5,7 @@
#
require 'delegate'
+require 'tmpdir'
# A class for managing temporary files. This library is written to be
# thread safe.
@@ -17,11 +18,10 @@ class Tempfile < SimpleDelegator
# object works just like a File object.
#
# If tmpdir is omitted, the temporary directory is determined by
- # ENV['TMPDIR'], ENV['TMP'] and and ENV['TEMP'] in the order named.
- # If none of them is available, or when $SAFE > 0 and the given
- # tmpdir is tainted, it uses /tmp. (Note that ENV values are
- # tainted by default)
- def initialize(basename, tmpdir=ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp')
+ # Dir::TMPDIR provided by 'tmpdir.rb'.
+ # When $SAFE > 0 and the given tmpdir is tainted, it uses
+ # /tmp. (Note that ENV values are tainted by default)
+ def initialize(basename, tmpdir=Dir::TMPDIR)
if $SAFE > 0 and tmpdir.tainted?
tmpdir = '/tmp'
end