"Document is distributed as a bundle" 是什么意思?

What does "Document is distributed as a bundle" mean?

我正在使用 Xcode 7.3.1 创建基于 Cocoa 文档的应用程序。我注意到在文档类型信息面板中有一个我不明白的选项。它说 "Document is distributed as a bundle" 看起来像这样。

我发现此选项控制应用程序 Info.plist 文件中 CFBundleDocumentTypesLSTypeIsPackage 键。我只能在 Apple 的官方文档中找到关于此键的用法的两个解释。两者都是相对较大的表格中非常简短的条目。

第一个解释来自App Creation Process Overview。它非常简短,除了上面的屏幕截图之外没有提供更多信息。

A Boolean value specifying whether the document is distributed as a bundle. If NO, omit this value.

第二个解释更有帮助。它来自 Mac 开发者库的 Information Property List Core Foundation Keys Reference.

Specifies whether the document is distributed as a bundle. If set to true, the bundle directory is treated as a file. (In OS X v10.4 and later, this key is ignored if the LSItemContentTypes key is present.)

听起来好像这个选项会影响 OS 对应用程序包本身的处理方式。如果是这样的话,那我真的不知道该怎么理解这些描述了。

我知道很多文档类型(比如.xcodeproj文档)其实都是目录。此设置是否控制文档是否为目录?

bundle 是一种专门的目录结构,您似乎已经知道,它包含特定的文件(如 Info.plist)。

一个 Document Package 就是这样的一个包。

因此

Does this setting control whether documents are directories?

是;但是您不会将其称为目录;这是一个捆绑包。