diff --git a/ChangeLog b/ChangeLog index ef6e9f15d0..eb76d689c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Mar 5 16:56:14 2009 Nobuyoshi Nakada + + * lib/tmpdir.rb (Dir.tmpdir): not use USERPROFILE, and ignores + non-existent directory. + Thu Mar 5 14:52:46 2009 Nobuyoshi Nakada * win32/win32.c (rb_w32_sysinit): initializes version info first. diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb index 788ddbd1ed..9fd36039d7 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