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