summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-05 07:56:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-05 07:56:19 +0000
commite691ba3baca5883a052d062df7c5d671c384ed0c (patch)
tree11d68fe551e77375c20dfc4c6f3d5d5f4aafcde4 /lib
parent90b0b8d4379ab10f3cde333cdd1d9e0d63fa3624 (diff)
* lib/tmpdir.rb (Dir.tmpdir): not use USERPROFILE, and ignores
non-existent directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/tmpdir.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb
index 788ddbd1edb..9fd36039d74 100644
--- a/lib/tmpdir.rb
+++ b/lib/tmpdir.rb
@@ -40,12 +40,11 @@ class Dir
if $SAFE > 0
tmp = @@systmpdir
else
- for dir in [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'],
- ENV['USERPROFILE'], @@systmpdir, '/tmp']
- if dir and File.directory?(dir) and File.writable?(dir)
+ for dir in [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp']
+ if dir and stat = File.stat(dir) and stat.directory? and stat.writable?
tmp = dir
break
- end
+ end rescue nil
end
File.expand_path(tmp)
end