Mac equivalent of ENV['APPDATA']

For my preferences I first check if the preference folder and files exist. If not then I create the preference files and write the defaults to them. In this way I never actually copy or move any files only the contents.

  def self.read_settings
    settings_file = @settings_path + 'settings.json'
    if File.exist?(settings_file)
      begin
        json = File.open(settings_file, 'r', &:read)
        @settings = JSON.parse(json)
        restore_default_settings unless @settings
        restore_colors unless @settings.key?('colors')
        restore_default_colors unless @settings.key?('default_colors')
        restore_default_building_specs unless @settings.key?('default_building')
        restore_colors unless @settings.key?('colors')
      rescue StandardError => _e
        restore_default_settings
      end
    else
      restore_default_settings
    end
  end

  def self.save_settings
    return unless @settings

    Dir.mkdir(@settings_path) unless Dir.exist?(@settings_path)
    settings_file = @settings_path + 'settings.json'
    File.open(settings_file, 'w') { |f| f.write(@settings.to_json) }
  end