From 67f281886a836b931639b6f27743c1f71ca078c9 Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Mon, 9 Sep 2019 14:17:54 +0900 Subject: [PATCH] Added a comment and remove one breaking change --- lib/android_apk.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/android_apk.rb b/lib/android_apk.rb index 3e3be8a..606d699 100644 --- a/lib/android_apk.rb +++ b/lib/android_apk.rb @@ -161,10 +161,8 @@ def icon_file(dpi = nil, want_png = false) icon.gsub! %r{res/(drawable|mipmap)/([^/]+)\.xml}, "res/\\1-#{dpis}-v4/\\2.png" end - # we cannot prepare for any fallbacks - if want_png && icon.end_with?(".xml") - return nil - end + # we cannot prepare for any fallbacks but don't return nil for now to keep the behavior + # if want_png && icon.end_with?(".xml") Dir.mktmpdir do |dir| output_to = File.join(dir, icon) @@ -175,7 +173,7 @@ def icon_file(dpi = nil, want_png = false) content = zip_file.find_entry(icon)&.get_input_stream&.read return nil if content.nil? - File.open(output_to, "w") do |f| + File.open(output_to, "wb") do |f| f.write(content) end end