diff --git a/lib/cocoapods-downloader/remote_file.rb b/lib/cocoapods-downloader/remote_file.rb index e4ae88f..c6b8dc5 100644 --- a/lib/cocoapods-downloader/remote_file.rb +++ b/lib/cocoapods-downloader/remote_file.rb @@ -110,7 +110,7 @@ def extract_with_type(full_filename, type = :zip) contents = target_path.children contents.delete(target_path + @filename) entry = contents.first - if contents.count == 1 && entry.directory? + if contents.count == 1 && entry.directory? && !isBundle?(entry) tmp_entry = entry.sub_ext("#{entry.extname}.tmp") begin FileUtils.move(entry, tmp_entry) @@ -173,6 +173,20 @@ def verify_checksum(filename) verify_sha1_hash(filename, options[:sha1]) end end + + # @note The entry is a bundle if it is a directory but has a bundle structure + # + # @return [Bool] Whether the entry is a bundle + # + + def isBundle?(entry) + isBundle = File.extname(entry) == '.framework' + isBundle ||= File.extname(entry) == '.app' + isBundle ||= File.extname(entry) == '.framework' + isBundle ||= File.extname(entry) == '.ipa' + isBundle ||= File.extname(entry) == '.xcappdata' + isBundle + end end end end