Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/tmpdir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Dir

##
# Returns the operating system's temporary file path.
#
# require 'tmpdir'
# Dir.tmpdir # => "/tmp"

def self.tmpdir
['TMPDIR', 'TMP', 'TEMP', ['system temporary path', SYSTMPDIR], ['/tmp']*2, ['.']*2].find do |name, dir|
Expand All @@ -45,6 +48,11 @@ def self.tmpdir

# Dir.mktmpdir creates a temporary directory.
#
# require 'tmpdir'
# Dir.mktmpdir {|dir|
# # use the directory
# }
#
# The directory is created with 0700 permission.
# Application should not change the permission to make the temporary directory accessible from other users.
#
Expand Down