add icons.reverse

This commit is contained in:
黄轩宇
2015-02-28 16:57:39 +08:00
parent 2c572ff427
commit d575ecc308
2 changed files with 2 additions and 3 deletions

View File

@@ -96,7 +96,6 @@ module Parser
icons << get_image("#{name}@2x")
end
icons.delete_if { |i| !i }
icons.reverse
rescue NoMethodError
[]
end

View File

@@ -35,7 +35,7 @@ module FIR
}
if is_all
app.icons.each_with_index do |icon, index|
app.icons.reverse.each_with_index do |icon, index|
tmp_icon_path = "#{Dir.tmpdir}/icon-#{SecureRandom.hex[4..9]}.png"
FileUtils.cp(icon, tmp_icon_path)
info["icon_#{index}".to_sym] = tmp_icon_path
@@ -63,7 +63,7 @@ module FIR
# apk.icon is a hash, { icon_name: icon_data }
if is_all
apk.icon.each_with_index do |name_with_data, index|
apk.icon.to_a.reverse.each_with_index do |name_with_data, index|
tmp_icon_path = "#{Dir.tmpdir}/icon-#{SecureRandom.hex[4..9]}.png"
File.open(tmp_icon_path, 'w+') { |f| f << name_with_data[1] }
info["icon_#{index}".to_sym] = tmp_icon_path