Skip to content
Closed
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
6 changes: 3 additions & 3 deletions lib/tmpdir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
end

class Dir

@@systmpdir ||= defined?(Etc.systmpdir) ? Etc.systmpdir : '/tmp'
SYSTMPDIR = defined?(Etc.systmpdir) ? Etc.systmpdir.dup.freeze : '/tmp'
private_constant :SYSTMPDIR

##
# Returns the operating system's temporary file path.

def self.tmpdir
['TMPDIR', 'TMP', 'TEMP', ['system temporary path', @@systmpdir], ['/tmp']*2, ['.']*2].find do |name, dir|
['TMPDIR', 'TMP', 'TEMP', ['system temporary path', SYSTMPDIR], ['/tmp']*2, ['.']*2].find do |name, dir|
unless dir
next if !(dir = ENV[name]) or dir.empty?
end
Expand Down