# File lib/uuid.rb, line 126
126:   def self.state_file(mode = 0644)
127:     return @state_file if @state_file
128: 
129:     @mode = mode
130: 
131:     begin
132:       require 'Win32API'
133: 
134:       csidl_common_appdata = 0x0023
135:       path = 0.chr * 260
136:       get_folder_path = Win32API.new('shell32', 'SHGetFolderPath', 'LLLLP', 'L')
137:       get_folder_path.call 0, csidl_common_appdata, 0, 1, path
138: 
139:       state_dir = File.join(path.strip)
140:     rescue LoadError
141:       state_dir = File.join('', 'var', 'tmp')
142:     end
143: 
144:     if File.writable?(state_dir) then
145:       @state_file = File.join(state_dir, 'ruby-uuid')
146:     else
147:       @state_file = File.expand_path(File.join('~', '.ruby-uuid'))
148:     end
149: 
150:     @state_file
151:   end