class LicenseAcceptance::Config

def default_license_locations

def default_license_locations
  if windows?
    l = [ File.join(ENV["HOMEDRIVE"], "chef/accepted_licenses/") ]
    unless is_root?
      # Look through a list of possible user locations and pick the first one that exists
      # copied from path_helper.rb in chef-config gem
      possible_dirs = []
      possible_dirs << ENV["HOME"] if ENV["HOME"]
      possible_dirs << ENV["HOMEDRIVE"] + ENV["HOMEPATH"] if ENV["HOMEDRIVE"] && ENV["HOMEPATH"]
      possible_dirs << ENV["HOMESHARE"] + ENV["HOMEPATH"] if ENV["HOMESHARE"] && ENV["HOMEPATH"]
      possible_dirs << ENV["USERPROFILE"] if ENV["USERPROFILE"]
      raise NoValidEnvironmentVar if possible_dirs.empty?
      possible_dirs.each do |possible_dir|
        if Dir.exist?(possible_dir)
          full_possible_dir = File.join(possible_dir, ".chef/accepted_licenses/")
          l << full_possible_dir
          break
        end
      end
    end
  else
    l = [ "/etc/chef/accepted_licenses/" ]
    l << File.join(ENV['HOME'], ".chef/accepted_licenses/") unless is_root?
  end
  l
end