2 # tmpdir - retrieve temporary directory path
4 # $Id: tmpdir.rb 11708 2007-02-12 23:01:19Z shyouhei $
14 windir = ' '*(max_pathlen+1)
16 getdir = Win32API.new('kernel32', 'GetSystemWindowsDirectory', 'PL', 'L')
18 getdir = Win32API.new('kernel32', 'GetWindowsDirectory', 'PL', 'L')
20 len = getdir.call(windir, windir.size)
21 windir = File.expand_path(windir[0, len])
22 temp = File.join(windir, 'temp')
23 @@systmpdir = temp if File.directory?(temp) and File.writable?(temp)
28 # Returns the operating system's temporary file path.
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)