Структура пакетов (bundles) в macOS и подобных системах
Bundle (macOS)
Bundle в NeXTSTEP, macOS, iOS и GNUstep: структура каталогов для группировки файлов (приложения, фреймворки, плагины). Отличие от Windows и старых Mac.
Сравнивайте с английским: нажмите на абзац — оригинал откроется в окне. Кнопка EN под абзацем показывает его прямо в тексте.
Содержание
Введение
Тип пакета каталогов
Type of directory bundle
В NeXTSTEP, OPENSTEP и их прямых наследниках macOS, iOS, iPadOS, tvOS и watchOS, а также в GNUstep, пакет представляет собой каталог файлов с определенной структурой и расширением, позволяющий группировать связанные файлы вместе как концептуально единый элемент. Примеры пакетов, содержащих исполняемый код, включают приложения, фреймворки и плагины. Этот тип пакета обычно содержит один файл, представляющий исполняемый код, и файлы, представляющие ресурсы, такие как nib-файлы, шаблоны, изображения, звуки и другие медиафайлы. В некоторых других системах, таких как Microsoft Windows, эти ресурсы обычно включаются непосредственно в исполняемый файл во время компиляции. На старых Macintosh использовалась аналогичная техника, при которой дополнительные метаданные могли быть добавлены в ресурсную ветвь файла. Похожие по концепции каталоги приложений используются в RISC OS и на рабочем столе ROX. Примеры пакетов, не содержащих исполняемый код, включают пакеты документов (документы iWork) и медиатеки (медиатека iPhoto). Пакеты программно доступны через класс NSBundle в Cocoa, фреймворках Foundation NeXTSTEP и GNUstep, а также через CFBundle в Core Foundation. Пакеты часто включают файл для хранения метаданных. Универсальный идентификатор типа (UTI) для пакета Apple — com.apple.bundle.
In NeXTSTEP, OPENSTEP, and their lineal descendants macOS, iOS, iPadOS, tvOS, and watchOS, and in GNUstep, a bundle is a file directory with a defined structure and file extension, allowing related files to be grouped together as a conceptually single item. Examples of bundles that contain executable code include applications, frameworks, and plugins. This kind of bundle usually contains one file representing executable code, and files that represent resources such as nibs, templates, images, sounds, and other media. On some other systems, such as Microsoft Windows, these resources are usually included directly in the executable file itself at compile time. On older Macintoshes, a similar technique is used, where additional metadata can be added to a file's resource fork. Similar in concept are the application directories used in RISC OS and on the ROX Desktop. Examples of bundles that do not contain executable code include document packages (iWork documents) and media libraries (iPhoto Library). Bundles are programmatically accessed with the NSBundle class in Cocoa, NeXTSTEP and GNUstep's Foundation frameworks, and with CFBundle in Core Foundation. Bundles often include an file for metadata. The Uniform Type Identifier (UTI) for an Apple bundle is com. apple. bundle.
Комплекты приложений
Пакеты приложений представляют собой иерархию каталогов, при этом каталог верхнего уровня имеет имя, заканчивающееся расширением приложения. В пакете приложения macOS первый каталог под каталогом верхнего уровня обычно называется Contents (Содержание). Внутри Contents обычно находится еще один каталог, называемый MacOS, который содержит исполняемый код приложения. В папке Contents содержится файл Info.plist, содержащий информацию о приложении, такую как имя поставщика программного обеспечения, имена файлов, содержащих исполняемый файл и значок приложения, версию приложения, запрошенные разрешения и т.д. В папке Contents обычно также находится каталог Resources (Ресурсы), который содержит ресурсы приложения. В частности, папка Resources содержит локализованные версии файлов nib приложения. Другие распространенные подкаталоги включают Plugins (Плагины), Frameworks (Фреймворки), CodeSignature и Shared Frameworks (Общие фреймворки). Каталог Frameworks содержит фреймворки, используемые приложением, и они используются даже в том случае, если в системе существует другая версия фреймворка. Каталог Shared Frameworks содержит фреймворки, которые могут использоваться как приложением, которое их содержит, так и другими приложениями; они используются только в том случае, если более новая версия отсутствует в другом месте системы. Plugins содержит расширяемый код, используемый приложением. Папка CodeSignature содержит информацию, используемую системой для проверки подлинности пакета, чтобы убедиться, что он исходит от доверенного источника и не был подделан. По умолчанию Finder отображает пакеты приложений, которые также можно называть пакетами, как непрозрачные файлы без внутренней структуры; содержимое пакета можно отобразить с помощью пункта контекстного меню "Показать содержимое пакета". GNUstep по умолчанию использует имя приложения для именования папки, содержащей код приложения. Альтернативно, их можно именовать по архитектуре компьютера и операционной системе, для которых предназначен код, чтобы создать универсальный двоичный файл, позволяющий открывать приложение на многих платформах.
Application bundles are directory hierarchies, with the top level directory having a name that ends with a app extension. In a macOS application bundle, the first directory in the bundle underneath the top level directory is usually named Contents. Within Contents there is usually another directory, called MacOS, which contains the application's executable code. The Contents folder contains a file named Info. plist, which contains application information, such as the software vendor's name, name of the files that contain the applications executable and icon, the version of the application, permissions requested, etc. Within the Contents folder there is usually also a directory called Resources, which contains the resources of the application. Among other things, the Resources folder contains localized versions of the application's nib files. Other common subdirectories include Plugins, Frameworks, CodeSignature and Shared Frameworks. The Frameworks directory contains frameworks used by the application, and are used even if another version of the framework exists on the system. The Shared Frameworks directory contains frameworks that can be used both by the application that contains them, and other applications; they are used only if a newer version does not exist elsewhere on the system. Plugins contains extensible code used by the application. The CodeSignature folder contains information used by the system to validate that the package to establish that the package originates from a trusted party, and has not been tampered with. By default, the Finder displays application bundles, which can also be referred to as packages, as opaque files with no underlying structure; the contents of the bundle can be shown with the "Show Package Contents" context menu item. GNUstep by default uses the name of the application to name the folder that contains application code. An alternative is to name them by the computer architecture and OS the code is intended for to form a fat binary, so the application can be opened on many platforms.
Фреймворковые пакеты macOS
Фреймворки macOS также хранятся в виде пакетов; корневой каталог пакета фреймворка имеет имя, совпадающее с именем фреймворка, с добавлением расширения "framework". В корневом каталоге находится каталог "Versions", содержащий подкаталоги для одной или нескольких версий фреймворка. Каждый подкаталог содержит код динамической библиотеки фреймворка в файле с тем же именем, что и у фреймворка, а также, возможно, папку "Headers" с файлами заголовков и другие подпапки, такие как "Resources". Каталог "Versions" также содержит символическую ссылку "Current", указывающую на каталог текущей версии фреймворка. В корневом каталоге имеются символические ссылки на содержимое "Versions/Current". Finder отображает пакеты фреймворков как каталоги, а не как непрозрачные файлы. Хотя GNUstep использует фреймворки, они обычно не хранятся в виде пакетов, поскольку полная семантика загрузки фреймворков считается слишком отличной от используемой на других платформах.
macOS frameworks are also stored as bundles; the top level directory of a framework bundle has a name that is the name of the framework followed by the extension framework. In the top level directory is a Versions directory, with subdirectories for one or more versions of the framework, each subdirectory containing the dynamic library code for the framework, in a file whose name is the same as the name of the framework, possibly with a Headers folder containing header files for the framework, and other subfolders such as Resources. The Versions directory also contains a symbolic link Current to the directory for the current version of the framework. In the top level directory are symbolic links to the contents of Versions/Current. The Finder displays framework bundles as directories rather than as opaque files. Although GNUstep uses frameworks, they are not usually stored as bundles. This is because the full semantics of framework loading are considered too alien to other platforms.
Загружаемые пакеты
Загружаемые пакеты — это пакеты, содержащие код, который можно загрузить во время выполнения. Загружаемые пакеты обычно имеют расширение «bundle» и чаще всего используются как плагины. В macOS существует способ загружать пакеты даже в приложения, которые их не поддерживают, что позволяет создавать сторонние модификации для популярных приложений, таких как Safari и Apple Mail. Эта функция, унаследованная от NeXTSTEP, также реализована в GNUstep. По умолчанию Finder отображает загружаемые пакеты, которые также можно называть пакетами, как непрозрачные файлы без видимой структуры; содержимое пакета можно просмотреть с помощью пункта контекстного меню «Показать содержимое пакета».
Loadable bundles are bundles which contain code that can be loaded at runtime. Loadable bundles usually have the extension bundle, and are most often used as plug ins. On macOS, there is a way to load bundles even into applications that do not support them, allowing for third party hacks for popular applications, such as Safari and Apple Mail. A feature inherited from NeXTSTEP, GNUstep has the interface too. By default, the Finder displays loadable bundles, which can also be referred to as packages, as opaque files with no underlying structure; the contents of the bundle can be shown with the "Show Package Contents" context menu item.
Другие пакеты
Существует множество приложений macOS, использующих собственный формат пакетов (например, CandyBar iContainer, Aperture aplibrary, VMware Fusion vmwarevm и другие).
There are many macOS applications which utilize their own custom bundle format (e. g. CandyBar iContainer, Aperture aplibrary, VMware Fusion vmwarevm, etc. ).
- Продолжаю.
Файл lproj — это пакет, содержащий файлы локализации для программного обеспечения OpenStep, macOS или GNUstep. Обычно он содержит файлы nib для определенного языка, а также файлы строк и изображения, если это требуется (например, файлы ReadMe или лицензионные соглашения). Эти локализованные файлы используются создателями установщиков для настройки установочных пакетов. Они также включаются в состав пакета приложения.
An lproj file is a bundle that contains localization files for OpenStep, macOS, or GNUstep software. It typically contains the nib files for a given language along with strings files and images if needed (for example, ReadMe or license files). These localized files are used by installer makers to customize install packages. They are also included in an application bundle.