1/*
2 * Copyright (c) 2014 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*	CFBundlePriv.h
25	Copyright (c) 1999-2013, Apple Inc.  All rights reserved.
26*/
27
28#if !defined(__COREFOUNDATION_CFBUNDLEPRIV__)
29#define __COREFOUNDATION_CFBUNDLEPRIV__ 1
30
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>
37
38CF_EXTERN_C_BEGIN
39
40/* Finder stuff */
41CF_EXPORT
42const CFStringRef _kCFBundlePackageTypeKey;
43CF_EXPORT
44const CFStringRef _kCFBundleSignatureKey;
45CF_EXPORT
46const CFStringRef _kCFBundleIconFileKey;
47CF_EXPORT
48const CFStringRef _kCFBundleDocumentTypesKey;
49CF_EXPORT
50const CFStringRef _kCFBundleURLTypesKey;
51
52/* Localizable Finder stuff */
53CF_EXPORT
54const CFStringRef _kCFBundleDisplayNameKey;
55CF_EXPORT
56const CFStringRef _kCFBundleShortVersionStringKey;
57CF_EXPORT
58const CFStringRef _kCFBundleGetInfoStringKey;
59CF_EXPORT
60const CFStringRef _kCFBundleGetInfoHTMLKey;
61
62/* Sub-keys for CFBundleDocumentTypes dictionaries */
63CF_EXPORT
64const CFStringRef _kCFBundleTypeNameKey;
65CF_EXPORT
66const CFStringRef _kCFBundleTypeRoleKey;
67CF_EXPORT
68const CFStringRef _kCFBundleTypeIconFileKey;
69CF_EXPORT
70const CFStringRef _kCFBundleTypeOSTypesKey;
71CF_EXPORT
72const CFStringRef _kCFBundleTypeExtensionsKey;
73CF_EXPORT
74const CFStringRef _kCFBundleTypeMIMETypesKey;
75
76/* Sub-keys for CFBundleURLTypes dictionaries */
77CF_EXPORT
78const CFStringRef _kCFBundleURLNameKey;
79CF_EXPORT
80const CFStringRef _kCFBundleURLIconFileKey;
81CF_EXPORT
82const CFStringRef _kCFBundleURLSchemesKey;
83
84/* Compatibility key names */
85CF_EXPORT
86const CFStringRef _kCFBundleOldExecutableKey;
87CF_EXPORT
88const CFStringRef _kCFBundleOldInfoDictionaryVersionKey;
89CF_EXPORT
90const CFStringRef _kCFBundleOldNameKey;
91CF_EXPORT
92const CFStringRef _kCFBundleOldIconFileKey;
93CF_EXPORT
94const CFStringRef _kCFBundleOldDocumentTypesKey;
95CF_EXPORT
96const CFStringRef _kCFBundleOldShortVersionStringKey;
97
98/* Compatibility CFBundleDocumentTypes key names */
99CF_EXPORT
100const CFStringRef _kCFBundleOldTypeNameKey;
101CF_EXPORT
102const CFStringRef _kCFBundleOldTypeRoleKey;
103CF_EXPORT
104const CFStringRef _kCFBundleOldTypeIconFileKey;
105CF_EXPORT
106const CFStringRef _kCFBundleOldTypeExtensions1Key;
107CF_EXPORT
108const CFStringRef _kCFBundleOldTypeExtensions2Key;
109CF_EXPORT
110const CFStringRef _kCFBundleOldTypeOSTypesKey;
111
112/* For platform specification */
113CF_EXPORT
114const CFStringRef _kCFBundleSupportedPlatformsKey;
115
116/* For Code Signing */
117CF_EXPORT
118const CFStringRef _kCFBundleResourceSpecificationKey;
119
120
121/* Functions for examining directories that may "look like" bundles */
122
123CF_EXPORT
124CFURLRef _CFBundleCopyBundleURLForExecutableURL(CFURLRef url);
125
126CF_EXPORT
127Boolean _CFBundleURLLooksLikeBundle(CFURLRef url);
128
129CF_EXPORT
130CFBundleRef _CFBundleCreateIfLooksLikeBundle(CFAllocatorRef allocator, CFURLRef url);
131
132CF_EXPORT
133CFBundleRef _CFBundleGetMainBundleIfLooksLikeBundle(void);
134
135CF_EXPORT
136Boolean _CFBundleMainBundleInfoDictionaryComesFromResourceFork(void);
137
138CF_EXPORT
139CFBundleRef _CFBundleCreateWithExecutableURLIfLooksLikeBundle(CFAllocatorRef allocator, CFURLRef url);
140
141CF_EXPORT
142CFURLRef _CFBundleCopyMainBundleExecutableURL(Boolean *looksLikeBundle);
143
144CF_EXPORT
145CFBundleRef _CFBundleGetExistingBundleWithBundleURL(CFURLRef bundleURL);
146
147CF_EXPORT
148CFArrayRef _CFBundleGetSupportedPlatforms(CFBundleRef bundle);
149
150CF_EXPORT
151CFStringRef _CFBundleGetCurrentPlatform(void);
152
153
154/* For Code Signing */
155
156CF_EXPORT
157CFBundleRef _CFBundleCreateIfMightBeBundle(CFAllocatorRef allocator, CFURLRef url);
158
159CF_EXPORT
160CFBundleRef _CFBundleCreateWithExecutableURLIfMightBeBundle(CFAllocatorRef allocator, CFURLRef url);
161
162
163/* Functions for examining the structure of a bundle */
164
165CF_EXPORT
166CFURLRef _CFBundleCopyResourceForkURL(CFBundleRef bundle) CF_AVAILABLE_MAC(10_0);
167
168CF_EXPORT
169CFURLRef _CFBundleCopyInfoPlistURL(CFBundleRef bundle);
170
171
172/* Functions for working without a bundle instance */
173
174CF_EXPORT
175CFURLRef _CFBundleCopyExecutableURLInDirectory(CFURLRef url);
176
177CF_EXPORT
178CFURLRef _CFBundleCopyOtherExecutableURLInDirectory(CFURLRef url);
179
180
181/* Functions for dealing with localizations */
182
183CF_EXPORT
184void _CFBundleGetLanguageAndRegionCodes(SInt32 *languageCode, SInt32 *regionCode);
185// may return -1 for either one if no code can be found
186
187CF_EXPORT
188Boolean 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. */
196
197CF_EXPORT
198CFStringRef 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. */
202
203CF_EXPORT
204void _CFBundleSetDefaultLocalization(CFStringRef localizationName);
205
206
207/* Functions for dealing specifically with CFM executables */
208
209CF_EXPORT
210void *_CFBundleGetCFMFunctionPointerForName(CFBundleRef bundle, CFStringRef funcName);
211
212CF_EXPORT
213void _CFBundleGetCFMFunctionPointersForNames(CFBundleRef bundle, CFArrayRef functionNames, void *ftbl[]);
214
215CF_EXPORT
216void _CFBundleSetCFMConnectionID(CFBundleRef bundle, void *connectionID);
217
218
219/* Miscellaneous functions */
220
221CF_EXPORT
222CFStringRef _CFBundleCopyFileTypeForFileURL(CFURLRef url);
223
224CF_EXPORT
225CFStringRef _CFBundleCopyFileTypeForFileData(CFDataRef data);
226
227CF_EXPORT
228Boolean _CFBundleGetHasChanged(CFBundleRef bundle);
229
230CF_EXPORT
231void _CFBundleFlushCaches(void) CF_DEPRECATED(10_0, 10_8, 2_0, 6_0);
232
233CF_EXPORT
234void _CFBundleFlushCachesForURL(CFURLRef url) CF_DEPRECATED(10_0, 10_8, 2_0, 6_0);
235
236CF_EXPORT
237void _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
238
239CF_EXPORT
240CFArrayRef _CFBundleCopyAllBundles(void); // Pending publication, the only known client of this is PowerBox. Email david_smith@apple.com before using this.
241
242CF_EXPORT
243void _CFBundleSetStringsFilesShared(CFBundleRef bundle, Boolean flag);
244
245CF_EXPORT
246Boolean _CFBundleGetStringsFilesShared(CFBundleRef bundle);
247
248CF_EXPORT
249CFURLRef _CFBundleCopyFrameworkURLForExecutablePath(CFStringRef executablePath);
250
251
252/* Functions deprecated as SPI */
253
254CF_EXPORT
255CFDictionaryRef _CFBundleGetLocalInfoDictionary(CFBundleRef bundle);	// deprecated in favor of CFBundleGetLocalInfoDictionary
256
257CF_EXPORT
258CFPropertyListRef _CFBundleGetValueForInfoKey(CFBundleRef bundle, CFStringRef key);	// deprecated in favor of CFBundleGetValueForInfoDictionaryKey
259
260CF_EXPORT
261Boolean _CFBundleGetPackageInfoInDirectory(CFAllocatorRef alloc, CFURLRef url, UInt32 *packageType, UInt32 *packageCreator);	// deprecated in favor of CFBundleGetPackageInfoInDirectory
262
263CF_EXPORT
264CFDictionaryRef _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
265
266CF_EXPORT
267CFURLRef _CFBundleCopyPrivateFrameworksURL(CFBundleRef bundle);		// deprecated in favor of CFBundleCopyPrivateFrameworksURL
268
269CF_EXPORT
270CFURLRef _CFBundleCopySharedFrameworksURL(CFBundleRef bundle);		// deprecated in favor of CFBundleCopySharedFrameworksURL
271
272CF_EXPORT
273CFURLRef _CFBundleCopySharedSupportURL(CFBundleRef bundle);		// deprecated in favor of CFBundleCopySharedSupportURL
274
275CF_EXPORT
276CFURLRef _CFBundleCopyBuiltInPlugInsURL(CFBundleRef bundle);		// deprecated in favor of CFBundleCopyBuiltInPlugInsURL
277
278CF_EXPORT
279CFURLRef _CFBundleCopyResourceURLForLanguage(CFBundleRef bundle, CFStringRef resourceName, CFStringRef resourceType, CFStringRef subDirName, CFStringRef language);	 // deprecated in favor of CFBundleCopyResourceURLForLocalization
280
281CF_EXPORT
282CFArrayRef _CFBundleCopyResourceURLsOfTypeForLanguage(CFBundleRef bundle, CFStringRef resourceType, CFStringRef subDirName, CFStringRef language);	// deprecated in favor of CFBundleCopyResourceURLsOfTypeForLocalization
283
284CF_EXPORT
285CFBundleRefNum _CFBundleOpenBundleResourceFork(CFBundleRef bundle);	// deprecated in favor of CFBundleOpenBundleResourceMap
286
287CF_EXPORT
288void _CFBundleCloseBundleResourceFork(CFBundleRef bundle);	// deprecated in favor of CFBundleCloseBundleResourceMap
289
290CF_EXTERN_C_END
291
292#endif /* ! __COREFOUNDATION_CFBUNDLEPRIV__ */
293
294