Class: Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/boxlet.rb

Overview

Configure our temporary folder

Class Method Summary collapse

Class Method Details

.tmpdirObject



99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/boxlet.rb', line 99

def Dir::tmpdir
  tmp = './tmp'
  if $SAFE > 0
    tmp = @@systmpdir
  else
    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 rescue nil
    end
    File.expand_path(tmp)
  end
end