|
|
< Previous PageNext Page > |
When you use a bundle-specific programming interface to locate a given resource, it performs a search to ensure that the right version of the resource is returned to you. Because resources can be global or localized as well as platform specific, the search may be complex. Various resource-finding APIs insulate you from potential changes to the bundle packaging scheme and handle a lot of tricky searching issues for you. You should always use these APIs instead of searching around inside the bundle yourself.
The Figure 4-2 details the steps a system routine uses to locate a resource.
Figure 4-2 Locating a resource in a bundle
Notice that global resources take precedence over localized resources. In fact, there should never be both a global and localized version of a given resource. If there is a global version of a given resource, localized versions of that same resource will never be found. The reason for this precedence is performance. If the localizable resources were searched first, the bundle routines might search needlessly in several localized resource folders before discovering the global resource. Also notice that in order to find a platform-specific resource, the platform-generic version must exist. Again, the reason is performance. You should generally make one platform’s version of the resource generic and provide platform-specific versions for any other platforms.
When a resource-locating routine finds a resource, it checks
to see if a platform-specific version exists. Platform-specific
resources are named using standard identifiers. The names you can
use when making platform-specific resources are macosclassic
(in
Mac OS 9) and macos
(in
Mac OS X). You construct the name of a platform-specific resource
by combining the platform-generic name with the platform identifier
string. For example, if you have a resource named Fish.jpg
,
its name, when specific to Mac OS 9, would be Fish-macosclassic.jpg
.
When an application running in Mac OS 9 requests the resource Fish.jpg
,
the bundle routine also checks to see if Fish-macosclassic.jpg
exists
in that same folder. If it does, the routine returns the path to
the platform-specific resource; if it does not, it returns the path
to Fish.jpg
. As was mentioned
previously, for Fish-macosclassic.jpg
to
be found, a file named Fish.jpg
must
exist in the same folder (including language-specific resource directories).
< Previous PageNext Page > |
Last updated: 2003-08-21
![]() |
![]() |
![]() |
![]() | ||
![]() | ||
Get information on Apple products.
Visit the Apple Store online or at retail locations. 1-800-MY-APPLE Copyright © 2003 Apple Computer, Inc. All rights reserved. | Terms of use | Privacy Notice |