Class Dir
In: tmpdir.rb
Parent: Object

tmpdir - retrieve temporary directory path

$Id: tmpdir.rb 11708 2007-02-12 23:01:19Z shyouhei $

Methods

tmpdir  

Public Class methods

Returns the operating system‘s temporary file path.

[Source]

# File 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.expand_path(tmp)
  end

[Validate]

ruby-doc.org is hosted and run by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. Ruby-doc.org was created in 2002 to promote the Ruby language and to help other Ruby hackers.

Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.

For more information on the Ruby programming language, visit ruby-lang.org.

Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.