1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2009-03-05 07:56:19 +00:00
parent 90b0b8d437
commit e691ba3bac
2 changed files with 8 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Thu Mar 5 16:56:14 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/tmpdir.rb (Dir.tmpdir): not use USERPROFILE, and ignores
non-existent directory.
Thu Mar 5 14:52:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (rb_w32_sysinit): initializes version info first.

View file

@ -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