Compressing `.app` MacOS application into a ZIP
Hi, I tried using zipline to zip up a MacOS .app application, but, it's treating it as a folder and is failing to produce a ZIP with a valid app.
When I extract the .app from the zip, the Icon? filesize is 0 and the app can't be opened.
I tried zipping it up using the code below but it produces a corrupted application:
def all_files_and_dirs(base)
Dir.glob("#{base}/**/*", File::FNM_DOTMATCH).reject { |f| f =~ /\/\.\.?$/ }
end
*all_files_and_dirs(ndf_base_path.join('myapp.app')).collect do |file|
if File.file?(file)
[
StringIO.new(File.binread(file)),
file.sub(ndf_base_path.join('Stornaway NDF Player v1.app').to_s, ''),
]
elsif File.directory?(file)
[StringIO.new, file.sub(ndf_base_path.join('Stornaway NDF Player v1.app').to_s, '') + '/.keep']
end
end,
Is this doable using zipline or zip_kit?
Thanks!
aren't .apps actually folders?
.app are packages, so in addition to being folders they also need xattr preservation to be properly zipped and unzipped I believe. I never implemented this in zip_kit but will accept a patch - zipkit does not read the filesystem by default, so this will likely involve some extra work. A ZIP needs to be made of a .app using the Finder and then checks need to be done on what extra fields the BOMArchiveHelper outputs.