Method: U3d::Utils.windows_local_appdata

Defined in:
lib/u3d/utils.rb

.windows_local_appdataObject



101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/u3d/utils.rb', line 101

def windows_local_appdata
  require 'win32api'

  windir = ' ' * 261

  getdir = Win32API.new('shell32', 'SHGetFolderPath', 'LLLLP', 'L')
  result = getdir.call(0, CSIDL_LOCAL_APPDATA, 0, 0, windir)
  raise "Unable to get Local Appdata directory, returned with value #{result}" unless result.zero?
  windir.rstrip!
  windir = File.expand_path(windir.rstrip)

  return windir if Dir.exist? windir
  raise "Local Appdata retrieved (#{windir}) is not correct"
end