2 * Copyright (c) 2012 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 Copyright (c) 1999-2011, Apple Inc. All rights reserved.
28 #if !defined(__COREFOUNDATION_CFBUNDLEPRIV__)
29 #define __COREFOUNDATION_CFBUNDLEPRIV__ 1
31 #include <CoreFoundation/CFBase.h>
32 #include <CoreFoundation/CFArray.h>
33 #include <CoreFoundation/CFBundle.h>
34 #include <CoreFoundation/CFDictionary.h>
35 #include <CoreFoundation/CFString.h>
36 #include <CoreFoundation/CFURL.h>
42 const CFStringRef _kCFBundlePackageTypeKey
;
44 const CFStringRef _kCFBundleSignatureKey
;
46 const CFStringRef _kCFBundleIconFileKey
;
48 const CFStringRef _kCFBundleDocumentTypesKey
;
50 const CFStringRef _kCFBundleURLTypesKey
;
52 /* Localizable Finder stuff */
54 const CFStringRef _kCFBundleDisplayNameKey
;
56 const CFStringRef _kCFBundleShortVersionStringKey
;
58 const CFStringRef _kCFBundleGetInfoStringKey
;
60 const CFStringRef _kCFBundleGetInfoHTMLKey
;
62 /* Sub-keys for CFBundleDocumentTypes dictionaries */
64 const CFStringRef _kCFBundleTypeNameKey
;
66 const CFStringRef _kCFBundleTypeRoleKey
;
68 const CFStringRef _kCFBundleTypeIconFileKey
;
70 const CFStringRef _kCFBundleTypeOSTypesKey
;
72 const CFStringRef _kCFBundleTypeExtensionsKey
;
74 const CFStringRef _kCFBundleTypeMIMETypesKey
;
76 /* Sub-keys for CFBundleURLTypes dictionaries */
78 const CFStringRef _kCFBundleURLNameKey
;
80 const CFStringRef _kCFBundleURLIconFileKey
;
82 const CFStringRef _kCFBundleURLSchemesKey
;
84 /* Compatibility key names */
86 const CFStringRef _kCFBundleOldExecutableKey
;
88 const CFStringRef _kCFBundleOldInfoDictionaryVersionKey
;
90 const CFStringRef _kCFBundleOldNameKey
;
92 const CFStringRef _kCFBundleOldIconFileKey
;
94 const CFStringRef _kCFBundleOldDocumentTypesKey
;
96 const CFStringRef _kCFBundleOldShortVersionStringKey
;
98 /* Compatibility CFBundleDocumentTypes key names */
100 const CFStringRef _kCFBundleOldTypeNameKey
;
102 const CFStringRef _kCFBundleOldTypeRoleKey
;
104 const CFStringRef _kCFBundleOldTypeIconFileKey
;
106 const CFStringRef _kCFBundleOldTypeExtensions1Key
;
108 const CFStringRef _kCFBundleOldTypeExtensions2Key
;
110 const CFStringRef _kCFBundleOldTypeOSTypesKey
;
112 /* For platform specification */
114 const CFStringRef _kCFBundleSupportedPlatformsKey
;
116 /* For Code Signing */
118 const CFStringRef _kCFBundleResourceSpecificationKey
;
121 /* Functions for examining directories that may "look like" bundles */
124 CFURLRef
_CFBundleCopyBundleURLForExecutableURL(CFURLRef url
);
127 Boolean
_CFBundleURLLooksLikeBundle(CFURLRef url
);
130 CFBundleRef
_CFBundleCreateIfLooksLikeBundle(CFAllocatorRef allocator
, CFURLRef url
);
133 CFBundleRef
_CFBundleGetMainBundleIfLooksLikeBundle(void);
136 Boolean
_CFBundleMainBundleInfoDictionaryComesFromResourceFork(void);
139 CFBundleRef
_CFBundleCreateWithExecutableURLIfLooksLikeBundle(CFAllocatorRef allocator
, CFURLRef url
);
142 CFURLRef
_CFBundleCopyMainBundleExecutableURL(Boolean
*looksLikeBundle
);
145 CFBundleRef
_CFBundleGetExistingBundleWithBundleURL(CFURLRef bundleURL
);
148 CFArrayRef
_CFBundleGetSupportedPlatforms(CFBundleRef bundle
);
151 CFStringRef
_CFBundleGetCurrentPlatform(void);
154 /* For Code Signing */
157 CFBundleRef
_CFBundleCreateIfMightBeBundle(CFAllocatorRef allocator
, CFURLRef url
);
160 CFBundleRef
_CFBundleCreateWithExecutableURLIfMightBeBundle(CFAllocatorRef allocator
, CFURLRef url
);
163 /* Functions for examining the structure of a bundle */
166 CFURLRef
_CFBundleCopyResourceForkURL(CFBundleRef bundle
);
169 CFURLRef
_CFBundleCopyInfoPlistURL(CFBundleRef bundle
);
172 /* Functions for working without a bundle instance */
175 CFURLRef
_CFBundleCopyExecutableURLInDirectory(CFURLRef url
);
178 CFURLRef
_CFBundleCopyOtherExecutableURLInDirectory(CFURLRef url
);
181 /* Functions for dealing with localizations */
184 void _CFBundleGetLanguageAndRegionCodes(SInt32
*languageCode
, SInt32
*regionCode
);
185 // may return -1 for either one if no code can be found
188 Boolean
CFBundleGetLocalizationInfoForLocalization(CFStringRef localizationName
, SInt32
*languageCode
, SInt32
*regionCode
, SInt32
*scriptCode
, CFStringEncoding
*stringEncoding
);
189 /* Gets the appropriate language and region codes, and the default */
190 /* script code and encoding, for the localization specified. */
191 /* Pass NULL for the localizationName to get these values for the */
192 /* single most preferred localization in the current context. */
193 /* May give -1 if there is no language or region code for a particular */
194 /* localization. Returns false if CFBundle has no information about */
195 /* the given localization. */
198 CFStringRef
CFBundleCopyLocalizationForLocalizationInfo(SInt32 languageCode
, SInt32 regionCode
, SInt32 scriptCode
, CFStringEncoding stringEncoding
);
199 /* Returns the default localization for the combination of codes */
200 /* specified. Pass in -1 for language, region code, or script code, or */
201 /* 0xFFFF for stringEncoding, if you do not wish to specify one of these. */
204 void _CFBundleSetDefaultLocalization(CFStringRef localizationName
);
207 /* Functions for dealing specifically with CFM executables */
210 void *_CFBundleGetCFMFunctionPointerForName(CFBundleRef bundle
, CFStringRef funcName
);
213 void _CFBundleGetCFMFunctionPointersForNames(CFBundleRef bundle
, CFArrayRef functionNames
, void *ftbl
[]);
216 void _CFBundleSetCFMConnectionID(CFBundleRef bundle
, void *connectionID
);
219 /* Miscellaneous functions */
222 CFStringRef
_CFBundleCopyFileTypeForFileURL(CFURLRef url
);
225 CFStringRef
_CFBundleCopyFileTypeForFileData(CFDataRef data
);
228 Boolean
_CFBundleGetHasChanged(CFBundleRef bundle
);
231 void _CFBundleFlushCaches(void);
234 void _CFBundleFlushCachesForURL(CFURLRef url
);
237 void _CFBundleFlushBundleCaches(CFBundleRef bundle
); // The previous two functions flush cached resource paths; this one also flushes bundle-specific caches such as the info dictionary and strings files
240 CFArrayRef
_CFBundleCopyAllBundles(void); // Pending publication, the only known client of this is PowerBox. Email david_smith@apple.com before using this.
243 void _CFBundleSetStringsFilesShared(CFBundleRef bundle
, Boolean flag
);
246 Boolean
_CFBundleGetStringsFilesShared(CFBundleRef bundle
);
249 CFURLRef
_CFBundleCopyFrameworkURLForExecutablePath(CFStringRef executablePath
);
252 /* Functions deprecated as SPI */
255 CFDictionaryRef
_CFBundleGetLocalInfoDictionary(CFBundleRef bundle
); // deprecated in favor of CFBundleGetLocalInfoDictionary
258 CFPropertyListRef
_CFBundleGetValueForInfoKey(CFBundleRef bundle
, CFStringRef key
); // deprecated in favor of CFBundleGetValueForInfoDictionaryKey
261 Boolean
_CFBundleGetPackageInfoInDirectory(CFAllocatorRef alloc
, CFURLRef url
, UInt32
*packageType
, UInt32
*packageCreator
); // deprecated in favor of CFBundleGetPackageInfoInDirectory
264 CFDictionaryRef
_CFBundleCopyInfoDictionaryInResourceFork(CFURLRef url
); // CFBundleCopyInfoDictionaryForURL is usually preferred; for the main bundle, however, no special call is necessary, since the info dictionary will automatically be available whether the app is bundled or not
267 CFURLRef
_CFBundleCopyPrivateFrameworksURL(CFBundleRef bundle
); // deprecated in favor of CFBundleCopyPrivateFrameworksURL
270 CFURLRef
_CFBundleCopySharedFrameworksURL(CFBundleRef bundle
); // deprecated in favor of CFBundleCopySharedFrameworksURL
273 CFURLRef
_CFBundleCopySharedSupportURL(CFBundleRef bundle
); // deprecated in favor of CFBundleCopySharedSupportURL
276 CFURLRef
_CFBundleCopyBuiltInPlugInsURL(CFBundleRef bundle
); // deprecated in favor of CFBundleCopyBuiltInPlugInsURL
279 CFArrayRef
_CFBundleCopyBundleRegionsArray(CFBundleRef bundle
); // deprecated in favor of CFBundleCopyBundleLocalizations
282 CFURLRef
_CFBundleCopyResourceURLForLanguage(CFBundleRef bundle
, CFStringRef resourceName
, CFStringRef resourceType
, CFStringRef subDirName
, CFStringRef language
); // deprecated in favor of CFBundleCopyResourceURLForLocalization
285 CFArrayRef
_CFBundleCopyResourceURLsOfTypeForLanguage(CFBundleRef bundle
, CFStringRef resourceType
, CFStringRef subDirName
, CFStringRef language
); // deprecated in favor of CFBundleCopyResourceURLsOfTypeForLocalization
288 CFBundleRefNum
_CFBundleOpenBundleResourceFork(CFBundleRef bundle
); // deprecated in favor of CFBundleOpenBundleResourceMap
291 void _CFBundleCloseBundleResourceFork(CFBundleRef bundle
); // deprecated in favor of CFBundleCloseBundleResourceMap
295 #endif /* ! __COREFOUNDATION_CFBUNDLEPRIV__ */