Class: Dir
- Inherits:
-
Object
- Object
- Dir
- Defined in:
- lib/tmpdir.rb
Overview
tmpdir - retrieve temporary directory path
$Id$
Constant Summary collapse
- @@systmpdir =
'/tmp'
Class Method Summary collapse
-
.tmpdir ⇒ Object
Returns the operating system’s temporary file path.
Class Method Details
.tmpdir ⇒ Object
Returns the operating system’s temporary file path.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/tmpdir.rb', line 30 def Dir::tmpdir tmp = '.' 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) tmp = dir break end end end File.(tmp) end |