CFBundlePriv.h
1 /* 2 * Copyright (c) 2015 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-2014, 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 38 CF_EXTERN_C_BEGIN 39 40 /* Finder stuff */ 41 CF_EXPORT 42 const CFStringRef _kCFBundlePackageTypeKey; 43 CF_EXPORT 44 const CFStringRef _kCFBundleSignatureKey; 45 CF_EXPORT 46 const CFStringRef _kCFBundleIconFileKey; 47 CF_EXPORT 48 const CFStringRef _kCFBundleDocumentTypesKey; 49 CF_EXPORT 50 const CFStringRef _kCFBundleURLTypesKey; 51 52 /* Localizable Finder stuff */ 53 CF_EXPORT 54 const CFStringRef _kCFBundleDisplayNameKey; 55 CF_EXPORT 56 const CFStringRef _kCFBundleShortVersionStringKey; 57 CF_EXPORT 58 const CFStringRef _kCFBundleGetInfoStringKey; 59 CF_EXPORT 60 const CFStringRef _kCFBundleGetInfoHTMLKey; 61 62 /* Sub-keys for CFBundleDocumentTypes dictionaries */ 63 CF_EXPORT 64 const CFStringRef _kCFBundleTypeNameKey; 65 CF_EXPORT 66 const CFStringRef _kCFBundleTypeRoleKey; 67 CF_EXPORT 68 const CFStringRef _kCFBundleTypeIconFileKey; 69 CF_EXPORT 70 const CFStringRef _kCFBundleTypeOSTypesKey; 71 CF_EXPORT 72 const CFStringRef _kCFBundleTypeExtensionsKey; 73 CF_EXPORT 74 const CFStringRef _kCFBundleTypeMIMETypesKey; 75 76 /* Sub-keys for CFBundleURLTypes dictionaries */ 77 CF_EXPORT 78 const CFStringRef _kCFBundleURLNameKey; 79 CF_EXPORT 80 const CFStringRef _kCFBundleURLIconFileKey; 81 CF_EXPORT 82 const CFStringRef _kCFBundleURLSchemesKey; 83 84 /* Compatibility key names */ 85 CF_EXPORT 86 const CFStringRef _kCFBundleOldExecutableKey; 87 CF_EXPORT 88 const CFStringRef _kCFBundleOldInfoDictionaryVersionKey; 89 CF_EXPORT 90 const CFStringRef _kCFBundleOldNameKey; 91 CF_EXPORT 92 const CFStringRef _kCFBundleOldIconFileKey; 93 CF_EXPORT 94 const CFStringRef _kCFBundleOldDocumentTypesKey; 95 CF_EXPORT 96 const CFStringRef _kCFBundleOldShortVersionStringKey; 97 98 /* Compatibility CFBundleDocumentTypes key names */ 99 CF_EXPORT 100 const CFStringRef _kCFBundleOldTypeNameKey; 101 CF_EXPORT 102 const CFStringRef _kCFBundleOldTypeRoleKey; 103 CF_EXPORT 104 const CFStringRef _kCFBundleOldTypeIconFileKey; 105 CF_EXPORT 106 const CFStringRef _kCFBundleOldTypeExtensions1Key; 107 CF_EXPORT 108 const CFStringRef _kCFBundleOldTypeExtensions2Key; 109 CF_EXPORT 110 const CFStringRef _kCFBundleOldTypeOSTypesKey; 111 112 /* For platform specification */ 113 CF_EXPORT 114 const CFStringRef _kCFBundleSupportedPlatformsKey; 115 116 /* For Code Signing */ 117 CF_EXPORT 118 const CFStringRef _kCFBundleResourceSpecificationKey; 119 120 121 /* Functions for examining directories that may "look like" bundles */ 122 123 CF_EXPORT 124 CFURLRef _CFBundleCopyBundleURLForExecutableURL(CFURLRef url); 125 126 CF_EXPORT 127 Boolean _CFBundleURLLooksLikeBundle(CFURLRef url); 128 129 CF_EXPORT 130 CFBundleRef _CFBundleCreateIfLooksLikeBundle(CFAllocatorRef allocator, CFURLRef url); 131 132 CF_EXPORT 133 CFBundleRef _CFBundleGetMainBundleIfLooksLikeBundle(void); 134 135 CF_EXPORT 136 Boolean _CFBundleMainBundleInfoDictionaryComesFromResourceFork(void); 137 138 CF_EXPORT 139 CFBundleRef _CFBundleCreateWithExecutableURLIfLooksLikeBundle(CFAllocatorRef allocator, CFURLRef url); 140 141 CF_EXPORT 142 CFURLRef _CFBundleCopyMainBundleExecutableURL(Boolean *looksLikeBundle); 143 144 CF_EXPORT 145 CFBundleRef _CFBundleGetExistingBundleWithBundleURL(CFURLRef bundleURL); 146 147 // This function is obsolete. 148 CF_EXPORT 149 CFArrayRef _CFBundleGetSupportedPlatforms(CFBundleRef bundle); 150 151 CF_EXPORT 152 CFStringRef _CFBundleGetCurrentPlatform(void); 153 154 155 /* For Code Signing */ 156 157 // This function is obsolete. Use CFBundleCreate instead. 158 CF_EXPORT 159 CFBundleRef _CFBundleCreateIfMightBeBundle(CFAllocatorRef allocator, CFURLRef url) CF_DEPRECATED(10_6, 10_10, 2_0, 8_0); 160 161 // This function is for code signing only. Do not use this function. 162 CF_EXPORT 163 CFBundleRef _CFBundleCreateWithExecutableURLIfMightBeBundle(CFAllocatorRef allocator, CFURLRef url); 164 165 166 /* Functions for examining the structure of a bundle */ 167 168 CF_EXPORT 169 CFURLRef _CFBundleCopyResourceForkURL(CFBundleRef bundle) CF_AVAILABLE_MAC(10_0); 170 171 CF_EXPORT 172 CFURLRef _CFBundleCopyInfoPlistURL(CFBundleRef bundle); 173 174 175 /* Functions for working without a bundle instance */ 176 177 CF_EXPORT 178 CFURLRef _CFBundleCopyExecutableURLInDirectory(CFURLRef url); 179 180 CF_EXPORT 181 CFURLRef _CFBundleCopyOtherExecutableURLInDirectory(CFURLRef url); 182 183 184 /* Functions for dealing with localizations */ 185 186 CF_EXPORT 187 void _CFBundleGetLanguageAndRegionCodes(SInt32 *languageCode, SInt32 *regionCode); 188 // may return -1 for either one if no code can be found 189 190 CF_EXPORT 191 Boolean CFBundleGetLocalizationInfoForLocalization(CFStringRef localizationName, SInt32 *languageCode, SInt32 *regionCode, SInt32 *scriptCode, CFStringEncoding *stringEncoding); 192 /* Gets the appropriate language and region codes, and the default */ 193 /* script code and encoding, for the localization specified. */ 194 /* Pass NULL for the localizationName to get these values for the */ 195 /* single most preferred localization in the current context. */ 196 /* May give -1 if there is no language or region code for a particular */ 197 /* localization. Returns false if CFBundle has no information about */ 198 /* the given localization. */ 199 200 CF_EXPORT 201 CFStringRef CFBundleCopyLocalizationForLocalizationInfo(SInt32 languageCode, SInt32 regionCode, SInt32 scriptCode, CFStringEncoding stringEncoding); 202 /* Returns the default localization for the combination of codes */ 203 /* specified. Pass in -1 for language, region code, or script code, or */ 204 /* 0xFFFF for stringEncoding, if you do not wish to specify one of these. */ 205 206 // Get a localized string for a specific localization (including processing as strings dict file). This skips the usual cache for localized strings. 207 CF_EXPORT CFStringRef CFBundleCopyLocalizedStringForLocalization(CFBundleRef bundle, CFStringRef key, CFStringRef value, CFStringRef tableName, CFStringRef localizationName) CF_AVAILABLE(10_10, 8_0); 208 209 CF_EXPORT 210 void _CFBundleSetDefaultLocalization(CFStringRef localizationName); 211 212 213 /* Functions for dealing specifically with CFM executables */ 214 215 CF_EXPORT 216 void *_CFBundleGetCFMFunctionPointerForName(CFBundleRef bundle, CFStringRef funcName); 217 218 CF_EXPORT 219 void _CFBundleGetCFMFunctionPointersForNames(CFBundleRef bundle, CFArrayRef functionNames, void *ftbl[]); 220 221 CF_EXPORT 222 void _CFBundleSetCFMConnectionID(CFBundleRef bundle, void *connectionID); 223 224 225 /* Miscellaneous functions */ 226 227 CF_EXPORT 228 CFStringRef _CFBundleCopyFileTypeForFileURL(CFURLRef url); 229 230 CF_EXPORT 231 CFStringRef _CFBundleCopyFileTypeForFileData(CFDataRef data); 232 233 CF_EXPORT 234 Boolean _CFBundleGetHasChanged(CFBundleRef bundle); 235 236 CF_EXPORT 237 void _CFBundleFlushCaches(void) CF_DEPRECATED(10_0, 10_8, 2_0, 6_0); 238 239 CF_EXPORT 240 void _CFBundleFlushCachesForURL(CFURLRef url) CF_DEPRECATED(10_0, 10_8, 2_0, 6_0); 241 242 CF_EXPORT 243 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 244 245 CF_EXPORT 246 CFArrayRef _CFBundleCopyAllBundles(void); // Pending publication, the only known client of this is PowerBox. Email david_smith@apple.com before using this. 247 248 CF_EXPORT 249 void _CFBundleSetStringsFilesShared(CFBundleRef bundle, Boolean flag); 250 251 CF_EXPORT 252 Boolean _CFBundleGetStringsFilesShared(CFBundleRef bundle); 253 254 CF_EXPORT 255 CFURLRef _CFBundleCopyFrameworkURLForExecutablePath(CFStringRef executablePath); 256 257 #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 258 #include <xpc/xpc.h> 259 CF_EXPORT 260 void _CFBundleSetupXPCBootstrap(xpc_object_t bootstrap) CF_AVAILABLE(10_10, 8_0); 261 #endif 262 263 /* Functions deprecated as SPI */ 264 265 CF_EXPORT 266 CFDictionaryRef _CFBundleGetLocalInfoDictionary(CFBundleRef bundle); // deprecated in favor of CFBundleGetLocalInfoDictionary 267 268 CF_EXPORT 269 CFPropertyListRef _CFBundleGetValueForInfoKey(CFBundleRef bundle, CFStringRef key); // deprecated in favor of CFBundleGetValueForInfoDictionaryKey 270 271 CF_EXPORT 272 Boolean _CFBundleGetPackageInfoInDirectory(CFAllocatorRef alloc, CFURLRef url, UInt32 *packageType, UInt32 *packageCreator); // deprecated in favor of CFBundleGetPackageInfoInDirectory 273 274 CF_EXPORT 275 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 276 277 CF_EXPORT 278 CFURLRef _CFBundleCopyPrivateFrameworksURL(CFBundleRef bundle); // deprecated in favor of CFBundleCopyPrivateFrameworksURL 279 280 CF_EXPORT 281 CFURLRef _CFBundleCopySharedFrameworksURL(CFBundleRef bundle); // deprecated in favor of CFBundleCopySharedFrameworksURL 282 283 CF_EXPORT 284 CFURLRef _CFBundleCopySharedSupportURL(CFBundleRef bundle); // deprecated in favor of CFBundleCopySharedSupportURL 285 286 CF_EXPORT 287 CFURLRef _CFBundleCopyBuiltInPlugInsURL(CFBundleRef bundle); // deprecated in favor of CFBundleCopyBuiltInPlugInsURL 288 289 CF_EXPORT 290 CFURLRef _CFBundleCopyResourceURLForLanguage(CFBundleRef bundle, CFStringRef resourceName, CFStringRef resourceType, CFStringRef subDirName, CFStringRef language); // deprecated in favor of CFBundleCopyResourceURLForLocalization 291 292 CF_EXPORT 293 CFArrayRef _CFBundleCopyResourceURLsOfTypeForLanguage(CFBundleRef bundle, CFStringRef resourceType, CFStringRef subDirName, CFStringRef language); // deprecated in favor of CFBundleCopyResourceURLsOfTypeForLocalization 294 295 CF_EXPORT 296 CFBundleRefNum _CFBundleOpenBundleResourceFork(CFBundleRef bundle); // deprecated in favor of CFBundleOpenBundleResourceMap 297 298 CF_EXPORT 299 void _CFBundleCloseBundleResourceFork(CFBundleRef bundle); // deprecated in favor of CFBundleCloseBundleResourceMap 300 301 CF_EXPORT 302 CFBundleRef _CFBundleCreateUnique(CFAllocatorRef allocator, CFURLRef bundleURL) CF_AVAILABLE(10_11, 9_0); 303 304 CF_EXTERN_C_END 305 306 #endif /* ! __COREFOUNDATION_CFBUNDLEPRIV__ */ 307