如何创建与 Finder 的“压缩"格式相同的 zip 文件菜单项? [英] How to create a zip file in the same format as the Finder's "Compress" menu item?

查看:10
本文介绍了如何创建与 Finder 的“压缩"格式相同的 zip 文件菜单项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Mac OS X 上,您可以通过选择一些文件并从上下文菜单或文件菜单中选择压缩"来从 Finder 创建 zip 存档.不幸的是,生成的文件与由 zip 命令(使用默认选项)创建的存档不同.

On Mac OS X, you can create a zip archive from the Finder by selecting some files and selecting "Compress" from the contextual menu or the File menu. Unfortunately, the resulting file is not identical to the archive created by the zip command (with the default options).

这一区别对 Apple 运营的至少一项服务很重要,该服务无法接受使用 zip 命令创建的档案.必须手动创建档案阻止我完全自动化我的发布构建过程.

This distinction matters to at least one service operated by Apple, which fails to accept archives created with the zip command. Having to create archives manually is preventing me from fully automating my release build process.

如何在 shell 脚本中以正确的格式创建 zip 存档?

How can I create a zip archive in the correct format within a shell script?

自从很久以前写这个问题以来,我发现 dittozip 之间的主要区别在于它们如何处理符号链接:因为代码签名应用程序包内包含一个符号链接,它需要作为链接保存,而不是作为常规文件存储.ditto 默认会这样做,但 zip 不会(选项 -y 是必需的).

Since writing this question long ago, I've figured out that the key difference between ditto and zip is how they handle symbolic links: because the code signature inside an app bundle contains a symlink, it needs to be preserved as a link and not stored as a regular file. ditto does this by default, but zip does not (option -y is required).

推荐答案

使用同上命令行工具如下:

Use the ditto command-line tool as follows:

ditto -ck --rsrc --sequesterRsrc folder file.zip

请参阅同上的手册页 了解更多.

这篇关于如何创建与 Finder 的“压缩"格式相同的 zip 文件菜单项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆