Class Dir
In: tmpdir.rb
Parent: Object

tmpdir - retrieve temporary directory path

$Id: tmpdir.rb,v 1.5.2.1 2005/12/15 15:57:05 matz Exp $

Methods

tmpdir  

Public Class methods

Returns the operating system’s temporary file path.

[Source]

    # File tmpdir.rb, line 30
30:   def Dir::tmpdir
31:     tmp = '.'
32:     if $SAFE > 0
33:       tmp = @@systmpdir
34:     else
35:       for dir in [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'],
36:                   ENV['USERPROFILE'], @@systmpdir, '/tmp']
37:         if dir and File.directory?(dir) and File.writable?(dir)
38:           tmp = dir
39:           break
40:         end
41:       end
42:     end
43:     File.expand_path(tmp)
44:   end

Search

Google

Ruby API Docs

Links