mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-23 12:27:56 +08:00
[iOS] Only try to use asset catalog Info.plist content if reading succeeded.
The file may exist when either app icons or launch images are used, but that does not mean we can assume in either cases that the content is for that case.
This commit is contained in:
@@ -90,22 +90,24 @@ module Motion; module Project;
|
||||
if launch_images_asset_bundle
|
||||
path = asset_bundle_partial_info_plist_path(platform)
|
||||
if File.exist?(path)
|
||||
content = `/usr/libexec/PlistBuddy -c 'Print :UILaunchImages' "#{path}"`.strip
|
||||
images = []
|
||||
current_image = nil
|
||||
content.split("\n")[1..-2].each do |line|
|
||||
case line.strip
|
||||
when 'Dict {'
|
||||
current_image = {}
|
||||
when '}'
|
||||
images << current_image
|
||||
current_image = nil
|
||||
when /(\w+) = (.+)/
|
||||
current_image[$1] = $2
|
||||
content = `/usr/libexec/PlistBuddy -c 'Print :UILaunchImages' "#{path}" 2>&1`.strip
|
||||
if $?.success?
|
||||
images = []
|
||||
current_image = nil
|
||||
content.split("\n")[1..-2].each do |line|
|
||||
case line.strip
|
||||
when 'Dict {'
|
||||
current_image = {}
|
||||
when '}'
|
||||
images << current_image
|
||||
current_image = nil
|
||||
when /(\w+) = (.+)/
|
||||
current_image[$1] = $2
|
||||
end
|
||||
end
|
||||
unless images.empty?
|
||||
info_plist['UILaunchImages'] = images
|
||||
end
|
||||
end
|
||||
unless images.empty?
|
||||
info_plist['UILaunchImages'] = images
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -534,8 +534,10 @@ EOS
|
||||
if app_icons_asset_bundle
|
||||
path = asset_bundle_partial_info_plist_path(platform)
|
||||
if File.exist?(path)
|
||||
content = `/usr/libexec/PlistBuddy -c 'Print :CFBundleIcons:CFBundlePrimaryIcon:CFBundleIconFiles' "#{path}"`.strip
|
||||
self.icons = content.split("\n")[1..-2].map(&:strip)
|
||||
content = `/usr/libexec/PlistBuddy -c 'Print :CFBundleIcons:CFBundlePrimaryIcon:CFBundleIconFiles' "#{path}" 2>&1`.strip
|
||||
if $?.success?
|
||||
self.icons = content.split("\n")[1..-2].map(&:strip)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user