class Bundler::Dir
def self.tmpdir
def self.tmpdir tmp = nil ['TMPDIR', 'TMP', 'TEMP', ['system temporary path', @systmpdir], ['/tmp']*2, ['.']*2].each do |name, dir = ENV[name]| next if !dir dir = File.expand_path(dir) stat = File.stat(dir) rescue next case when !stat.directory? warn "#{name} is not a directory: #{dir}" when !stat.writable? warn "#{name} is not writable: #{dir}" when stat.world_writable? && !stat.sticky? warn "#{name} is world-writable: #{dir}" else tmp = dir break end end raise ArgumentError, "could not find a temporary directory" unless tmp tmp end