Bundle (NEXTSTEP)
From Wikipedia, the free encyclopedia
Under NEXTSTEP, Mac OS X and GNUstep, a bundle is a directory that allows related resources such as software code to be grouped together. They were introducted into the Macintosh world as packages in Mac OS 9 and are similar in concept to the Application Directories used in RISC OS and on the ROX Desktop.
Applications, frameworks, and plugins are most commonly grouped as bundles, although documents can also be grouped as bundles. They are manipulated with the NSBundle class in the NeXT Foundation kit, and with CFBundle under CoreFoundation.
A bundle usually contains one file representing executable code, and files that represent resources such as nibs, images, sounds, and other media. On 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. Beginning with the Mac OS X, however, the NEXTSTEP concept of bundles was adopted for this purpose. Most types of bundles are used and interacted with as though they were ordinary files on the system in an attempt to reduce accidental tampering. A bundle also aims to ease problems associated with organizing resources by using a more simple structure of hierarchical directories rather than the resource fork.
The Uniform Type Identifier (UTI) for a bundle is com.apple.bundle and for a package is com.apple.package.
Contents |
[edit] Application Bundles
Application bundles are often presented to users as a single file known as a "package". This file is really a directory ending in a .app extension. Control-clicking (or right-clicking) on the package allows a user to open up the bundle and see the contents. In an application, the first directory in the bundle is usually Contents; within contents there is usually another directory with the executable code (called MacOS for Macs, or the application's name for GNUstep), which contains the application's executable code, and 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, 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 UTI for an application is com.apple.application and an application bundle is com.apple.application-bundle .
[edit] Other bundle formats
Other bundles include Rich Text Format documents with images, which carry the .rtfd extension, OS X widgets, and partially downloaded files in Safari, which carry the .download extension. In GarageBand and iMovie HD, the project files are also represented as bundles.
Apple's installer packages (.pkg) are bundles that contain pax archives. See Installer (Mac OS X).
There are also some third-party Mac OS X applications which utilize their own custom bundle format (e.g. CandyBar's .iContainer bundles).
[edit] See also
- Application Directory - the RISC OS analogue to an application bundle
[edit] External links
- Bundle Programming Guide at Apple Developer Connection
- NSBundle documentation from the GNUstep project
- Platypus - a tool to create application bundles around scripts