Method: AppInfo::APK#icons

Defined in:
lib/app_info/apk.rb

#iconsObject



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/app_info/apk.rb', line 118

def icons
  unless @icons
    @icons = apk.icon.each_with_object([]) do |(path, data), obj|
      icon_name = File.basename(path)
      icon_path = File.join(contents, File.dirname(path))
      icon_file = File.join(icon_path, icon_name)
      FileUtils.mkdir_p icon_path
      File.open(icon_file, 'wb') { |f| f.write(data) }

      obj << {
        name: icon_name,
        file: icon_file,
        dimensions: ImageSize.path(icon_file).size
      }
    end
  end

  @icons
end