Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Untabify
Browse files Browse the repository at this point in the history
Hiroshi Nakamura committed Mar 2, 2012
1 parent a30b68d commit 716166f
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions lib/ruby/1.8/tmpdir.rb
Original file line number Diff line number Diff line change
@@ -47,15 +47,15 @@ def Dir::tmpdir
# Opening directory is not allowed in Java.
dirs = [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], ENV['USERPROFILE'], @@systmpdir, '/tmp', tmp]
for dir in dirs
if dir and File.directory?(dir) and File.writable?(dir) and (File.stat(dir).mode & 0002) == 0
if dir and File.directory?(dir) and File.writable?(dir) and (File.stat(dir).mode & 0002) == 0
return File.expand_path(dir)
end
end
end
for dir in dirs
if dir and File.directory?(dir) and File.writable?(dir)
tmp = dir
break
end
if dir and File.directory?(dir) and File.writable?(dir)
tmp = dir
break
end
end
File.expand_path(tmp)
end
10 changes: 5 additions & 5 deletions lib/ruby/1.9/tmpdir.rb
Original file line number Diff line number Diff line change
@@ -28,15 +28,15 @@ def Dir::tmpdir
# Opening directory is not allowed in Java.
dirs = [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp', tmp]
for dir in dirs
if dir and stat = File.stat(dir) and stat.directory? and stat.writable? and !stat.world_writable?
if dir and stat = File.stat(dir) and stat.directory? and stat.writable? and !stat.world_writable?
return File.expand_path(dir)
end
end
for dir in dirs
if dir and stat = File.stat(dir) and stat.directory? and stat.writable?
tmp = dir
break
end rescue nil
if dir and stat = File.stat(dir) and stat.directory? and stat.writable?
tmp = dir
break
end rescue nil
end
File.expand_path(tmp)
end

0 comments on commit 716166f

Please sign in to comment.