2 * Copyright (c) 2015 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) 2008-2014, Apple Inc. All rights reserved.
26 Responsibility: Jim Luther/Chris Linn
29 #if !defined(__COREFOUNDATION_CFURLPRIV__)
30 #define __COREFOUNDATION_CFURLPRIV__ 1
32 #include <CoreFoundation/CFBase.h>
33 #include <CoreFoundation/CFError.h>
34 #include <CoreFoundation/CFArray.h>
35 #include <CoreFoundation/CFDictionary.h>
36 #include <CoreFoundation/CFString.h>
37 #include <CoreFoundation/CFURL.h>
38 #include <CoreFoundation/CFFileSecurity.h>
39 #include <CoreFoundation/CFURLEnumerator.h>
40 #include <CoreFoundation/CFDate.h>
42 #include <sys/mount.h>
47 // The kCFURLxxxxError enums are error codes in the Cocoa error domain and they mirror the exact same codes in <Foundation/FoundationErrors.h> (i.e. kCFURLReadNoPermissionError = NSFileReadNoPermissionError = 257). They were added to CFURLPriv.h so that CarbonCore and later CoreServicesInternal could return these error codes in the Cocoa error domain. If your code links with Foundation, you should use the codes in <Foundation/FoundationErrors.h>, not these codes.
49 // Resource I/O related errors, with kCFErrorURLKey containing URL
50 kCFURLNoSuchResourceError
= 4, // Attempt to do a file system operation on a non-existent file
51 kCFURLResourceLockingError
= 255, // Couldn't get a lock on file
52 kCFURLReadUnknownError
= 256, // Read error (reason unknown)
53 kCFURLReadNoPermissionError
= 257, // Read error (permission problem)
54 kCFURLReadInvalidResourceNameError
= 258, // Read error (invalid file name)
55 kCFURLReadCorruptResourceError
= 259, // Read error (file corrupt, bad format, etc)
56 kCFURLReadNoSuchResourceError
= 260, // Read error (no such file)
57 kCFURLReadInapplicableStringEncodingError
= 261, // Read error (string encoding not applicable) also kCFStringEncodingErrorKey
58 kCFURLReadUnsupportedSchemeError
= 262, // Read error (unsupported URL scheme)
59 kCFURLReadTooLargeError
= 263, // Read error (file too large)
60 kCFURLReadUnknownStringEncodingError
= 264, // Read error (string encoding of file contents could not be determined)
61 kCFURLWriteUnknownError
= 512, // Write error (reason unknown)
62 kCFURLWriteNoPermissionError
= 513, // Write error (permission problem)
63 kCFURLWriteInvalidResourceNameError
= 514, // Write error (invalid file name)
64 kCFURLWriteInapplicableStringEncodingError
= 517, // Write error (string encoding not applicable) also kCFStringEncodingErrorKey
65 kCFURLWriteUnsupportedSchemeError
= 518, // Write error (unsupported URL scheme)
66 kCFURLWriteOutOfSpaceError
= 640, // Write error (out of storage space)
67 kCFURLWriteVolumeReadOnlyError
= 642, // Write error (readonly volume)
68 } CF_ENUM_AVAILABLE(10_5
, 2_0
);
72 Private File System Property Keys
74 CF_EXPORT
const CFStringRef _kCFURLPathKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
75 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLPathKey or NSURLPathKey public property keys */
77 CF_EXPORT
const CFStringRef _kCFURLVolumeIDKey
CF_AVAILABLE(10_6
, 4_0
);
78 /* Volume ID (CFNumber) */
80 CF_EXPORT
const CFStringRef _kCFURLInodeNumberKey
CF_AVAILABLE(10_6
, 4_0
);
81 /* 64-bit inode number (the inode number from the file system) (CFNumber) */
83 CF_EXPORT
const CFStringRef _kCFURLFileIDKey
CF_AVAILABLE(10_6
, 4_0
);
84 /* 64-bit file ID (for tracking a file by ID. This may or may not be the inode number) (CFNumber) */
86 CF_EXPORT
const CFStringRef _kCFURLParentDirectoryIDKey
CF_AVAILABLE(10_6
, 4_0
);
87 /* 64-bit file ID (for tracking a parent directory by ID. This may or may not be the inode number) (CFNumber) */
89 CF_EXPORT
const CFStringRef _kCFURLDistinctLocalizedNameKey
CF_AVAILABLE(10_6
, 4_0
);
90 /* The localized name, if it is distinct from the real name. Otherwise, NULL (CFString) */
92 CF_EXPORT
const CFStringRef _kCFURLNameExtensionKey
CF_AVAILABLE(10_6
, 4_0
);
93 /* The name extension (CFString) */
95 CF_EXPORT
const CFStringRef _kCFURLFinderInfoKey
CF_AVAILABLE(10_6
, 4_0
);
96 /* A 16-byte Finder Info structure immediately followed by a 16-byte Extended Finder Info structure (CFData) */
98 CF_EXPORT
const CFStringRef _kCFURLIsCompressedKey
CF_AVAILABLE(10_6
, 4_0
);
99 /* True if resource's data is transparently compressed by the system on its storage device (CFBoolean) */
101 CF_EXPORT
const CFStringRef _kCFURLIsApplicationKey
CF_AVAILABLE(10_6
, 4_0
);
102 /* True if resource is an application (CFBoolean) */
104 CF_EXPORT
const CFStringRef _kCFURLCanSetHiddenExtensionKey
CF_AVAILABLE(10_6
, 4_0
);
105 /* True if the filename extension can be hidden or unhidden (CFBoolean) */
107 CF_EXPORT
const CFStringRef _kCFURLIsReadableKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
108 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLIsReadableKey or NSURLIsReadableKey public property keys */
109 /* never implemented and scheduled for removal in 10.10/8.0 */CF_EXPORT
const CFStringRef _kCFURLUserCanReadKey
CF_DEPRECATED(10_0
, 10_6
, 2_0
, 4_0
);
111 CF_EXPORT
const CFStringRef _kCFURLIsWriteableKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
112 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLIsWritableKey or NSURLIsWritableKey public property keys */
113 /* never implemented and scheduled for removal in 10.10/8.0 */CF_EXPORT
const CFStringRef _kCFURLUserCanWriteKey
CF_DEPRECATED(10_0
, 10_6
, 2_0
, 4_0
);
115 CF_EXPORT
const CFStringRef _kCFURLIsExecutableKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
116 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLIsExecutableKey or NSURLIsExecutableKey public property keys */
117 /* never implemented and scheduled for removal in 10.10/8.0 */CF_EXPORT
const CFStringRef _kCFURLUserCanExecuteKey
CF_DEPRECATED(10_0
, 10_6
, 2_0
, 4_0
);
119 CF_EXPORT
const CFStringRef _kCFURLParentDirectoryIsVolumeRootKey
CF_AVAILABLE(10_6
, 4_0
);
120 /* True if the parent directory is the root of a volume (CFBoolean) */
122 CF_EXPORT
const CFStringRef _kCFURLFileSecurityKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
123 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLFileSecurityKey or NSURLFileSecurityKey public property keys */
125 CF_EXPORT
const CFStringRef _kCFURLFileSizeOfResourceForkKey
CF_AVAILABLE(10_6
, 4_0
);
126 /* Size in bytes of the resource fork (CFNumber) */
128 CF_EXPORT
const CFStringRef _kCFURLFileAllocatedSizeOfResourceForkKey
CF_AVAILABLE(10_6
, 4_0
);
129 /* Size in bytes of the blocks allocated for the resource fork (CFNumber) */
131 CF_EXPORT
const CFStringRef _kCFURLEffectiveIconImageDataKey
CF_AVAILABLE(10_6
, 4_0
);
132 /* Icon image data, i.e. raw pixel data (CFData) */
134 CF_EXPORT
const CFStringRef _kCFURLTypeBindingKey
CF_AVAILABLE(10_10
, 8_0
);
135 /* Type binding for icon (Read-only, value type CFData) */
137 CF_EXPORT
const CFStringRef _kCFURLCustomIconImageDataKey
CF_AVAILABLE(10_6
, 4_0
);
138 /* Icon image data of the item's custom icon, if any (CFData) */
140 CF_EXPORT
const CFStringRef _kCFURLEffectiveIconFlattenedReferenceDataKey
CF_AVAILABLE(10_6
, 4_0
);
141 /* Icon flattened reference, suitable for cheaply sharing the effective icon reference across processess (CFData) */
143 CF_EXPORT
const CFStringRef _kCFURLBundleIdentifierKey
CF_AVAILABLE(10_6
, 4_0
);
144 /* If resource is a bundle, the bundle identifier (CFString) */
146 CF_EXPORT
const CFStringRef _kCFURLVersionKey
CF_AVAILABLE(10_6
, 4_0
);
147 /* If resource is a bundle, the bundle version (CFBundleVersion) as a string (CFString) */
149 CF_EXPORT
const CFStringRef _kCFURLShortVersionStringKey
CF_AVAILABLE(10_6
, 4_0
);
150 /* If resource is a bundle, the bundle short version (CFBundleShortVersionString) as a string (CFString) */
152 CF_EXPORT
const CFStringRef _kCFURLOwnerIDKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
153 /* Deprecated and scheduled for removal later in 10.9/7.0 since it is unused - Use the kCFURLFileSecurityKey or NSURLFileSecurityKey public property keys and CFFileSecurityGetOwner() */
155 CF_EXPORT
const CFStringRef _kCFURLGroupIDKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
156 /* Deprecated and scheduled for removal later in 10.9/7.0 since it is unused - Use the kCFURLFileSecurityKey or NSURLFileSecurityKey public property keys and CFFileSecurityGetGroup() */
158 CF_EXPORT
const CFStringRef _kCFURLStatModeKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
159 /* Deprecated and scheduled for removal later in 10.9/7.0 since it is unused - Use the kCFURLFileSecurityKey or NSURLFileSecurityKey public property keys and CFFileSecurityGetMode() */
161 CF_EXPORT
const CFStringRef _kCFURLLocalizedNameDictionaryKey
CF_AVAILABLE(10_7
, NA
);
162 /* For items with localized display names, the dictionary of all available localizations. The keys are the cannonical locale strings for the available localizations. (CFDictionary) */
164 CF_EXPORT
const CFStringRef _kCFURLLocalizedTypeDescriptionDictionaryKey
CF_AVAILABLE(10_7
, NA
);
165 /* The dictionary of all available localizations of the item kind string. The keys are the cannonical locale strings for the available localizations. (CFDictionary) */
167 CF_EXPORT
const CFStringRef _kCFURLApplicationCategoriesKey
CF_AVAILABLE(10_7
, NA
);
168 /* The array of category UTI strings associated with the url. (CFArray) */
170 CF_EXPORT
const CFStringRef _kCFURLApplicationHighResolutionModeIsMagnifiedKey
CF_AVAILABLE(10_7
, NA
);
171 /* True if the app runs with magnified 1x graphics on a 2x display (Per-user, CFBoolean) */
173 CF_EXPORT
const CFStringRef _kCFURLCanSetApplicationHighResolutionModeIsMagnifiedKey
CF_AVAILABLE(10_7
, NA
);
174 /* True if the app can run in either magnified or native resolution modes (Read only, CFBoolean) */
176 CF_EXPORT
const CFStringRef _kCFURLWriterBundleIdentifierKey
CF_AVAILABLE(10_8
, NA
);
177 /* The bundle identifier of the process writing to this object (Read-write, value type CFString) */
179 CF_EXPORT
const CFStringRef _kCFURLApplicationNapIsDisabledKey
CF_AVAILABLE(10_9
, NA
);
180 /* True if app nap is disabled (Applications only, Per-user, CFBoolean) */
182 CF_EXPORT
const CFStringRef _kCFURLCanSetApplicationNapIsDisabledKey
CF_AVAILABLE(10_9
, NA
);
183 /* True if the ApplicationNapIsDisabled property value can be changed (Applications only, Read only, CFBoolean) */
185 /* Additional volume properties */
187 CF_EXPORT
const CFStringRef _kCFURLVolumeRefNumKey
CF_AVAILABLE(10_6
, 4_0
);
188 /* The Carbon File Manager's FSVolumeRefNum for the resource volume (CFNumber) */
190 CF_EXPORT
const CFStringRef _kCFURLVolumeUUIDStringKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
191 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeUUIDStringKey or NSURLVolumeUUIDStringKey public property keys */
193 CF_EXPORT
const CFStringRef _kCFURLVolumeCreationDateKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
194 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeCreationDateKey or NSURLVolumeCreationDateKey public property keys */
196 CF_EXPORT
const CFStringRef _kCFURLVolumeIsLocalKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
197 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsLocalKey or NSURLVolumeIsLocalKey public property keys */
199 CF_EXPORT
const CFStringRef _kCFURLVolumeIsAutomountKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
200 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsAutomountedKey or NSURLVolumeIsAutomountedKey public property keys */
202 CF_EXPORT
const CFStringRef _kCFURLVolumeDontBrowseKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
203 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsBrowsableKey or NSURLVolumeIsBrowsableKey public property keys (Note: value is inverse of _kCFURLVolumeDontBrowseKey) */
205 CF_EXPORT
const CFStringRef _kCFURLVolumeIsReadOnlyKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
206 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsReadOnlyKey or NSURLVolumeIsReadOnlyKey public property keys */
208 CF_EXPORT
const CFStringRef _kCFURLVolumeIsQuarantinedKey
CF_AVAILABLE(10_6
, 4_0
);
209 /* Mounted quarantined (CFBoolean) */
211 CF_EXPORT
const CFStringRef _kCFURLVolumeIsEjectableKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
212 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsEjectableKey or NSURLVolumeIsEjectableKey public property keys */
214 CF_EXPORT
const CFStringRef _kCFURLVolumeIsRemovableKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
215 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsRemovableKey or NSURLVolumeIsRemovableKey public property keys */
217 CF_EXPORT
const CFStringRef _kCFURLVolumeIsInternalKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
218 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsInternalKey or NSURLVolumeIsInternalKey public property keys (Note: this has slightly different behavior than the public VolumeIsInternal key) */
220 CF_EXPORT
const CFStringRef _kCFURLVolumeIsExternalKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
221 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeIsInternalKey or NSURLVolumeIsInternalKey public property keys (Note: this has slightly different behavior than the public VolumeIsInternal key) */
223 CF_EXPORT
const CFStringRef _kCFURLVolumeIsDiskImageKey
CF_AVAILABLE(10_6
, 4_0
);
224 /* Volume is a mounted disk image (CFBoolean) */
226 CF_EXPORT
const CFStringRef _kCFURLDiskImageBackingURLKey
CF_AVAILABLE(10_6
, 4_0
);
227 /* If volume is a mounted disk image, the URL of the backing disk image (CFURL) */
229 CF_EXPORT
const CFStringRef _kCFURLVolumeIsFileVaultKey
CF_AVAILABLE(10_6
, 4_0
);
230 /* Volume uses File Vault encryption (CFBoolean) */
232 CF_EXPORT
const CFStringRef _kCFURLVolumeIsiDiskKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
233 /* Deprecated and scheduled for removal in 10.10/8.0 - there are no more iDisks */
235 CF_EXPORT
const CFStringRef _kCFURLVolumeiDiskUserNameKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
236 /* Deprecated and scheduled for removal in 10.10/8.0 - there are no more iDisks */
238 CF_EXPORT
const CFStringRef _kCFURLVolumeIsLocaliDiskMirrorKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
239 /* Deprecated and scheduled for removal in 10.10/8.0 - there are no more iDisks */
241 CF_EXPORT
const CFStringRef _kCFURLVolumeIsiPodKey
CF_AVAILABLE(10_6
, 4_0
);
242 /* Volume is on an iPod (CFBoolean) */
244 CF_EXPORT
const CFStringRef _kCFURLVolumeIsCDKey
CF_AVAILABLE(10_6
, 4_0
);
245 /* Volume is a CD (audio or CD-ROM). (CFBoolean) */
247 CF_EXPORT
const CFStringRef _kCFURLVolumeIsDVDKey
CF_AVAILABLE(10_6
, 4_0
);
248 /* Volume is a DVD (CFBoolean) */
250 CF_EXPORT
const CFStringRef _kCFURLVolumeIsDeviceFileSystemKey
CF_AVAILABLE(10_7
, 5_0
);
251 /* Volume is devfs (CFBoolean) */
253 CF_EXPORT
const CFStringRef _kCFURLVolumeIsHFSStandardKey
CF_AVAILABLE(10_6
, 4_0
);
254 /* Volume is HFS standard (which includes AFP volumes). Directory IDs, but not file IDs, can be looked up. (CFBoolean) */
256 CF_EXPORT
const CFStringRef _kCFURLVolumeIOMediaIconFamilyNameKey
CF_AVAILABLE(10_9
, NA
);
257 /* Volume's IOMediaIconFamilyName. (CFStringRef) */
259 CF_EXPORT
const CFStringRef _kCFURLVolumeIOMediaIconBundleIdentifierKey
CF_AVAILABLE(10_9
, NA
);
260 /* Volume's IOMediaIconBundleIdentifier. (CFStringRef) */
262 CF_EXPORT
const CFStringRef _kCFURLVolumeQuarantinePropertiesKey
CF_AVAILABLE(10_10
, NA
);
263 /* The quarantine properties for the volume on which the resource resides as defined in LSQuarantine.h.=To remove quarantine information from a volume, pass kCFNull as the value when setting this property. (Read-write, value type CFDictionary) */
265 CF_EXPORT
const CFStringRef _kCFURLVolumeOpenFolderURLKey
CF_AVAILABLE(10_10
, NA
);
266 /* Returns a URL to the folder the Finder should open when a HFS volume is mounted, or NULL if there is none. (Read-only, value type CFURL) */
268 CF_EXPORT
const CFStringRef _kCFURLResolvedFromBookmarkDataKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
269 /* Deprecated and scheduled for removal later in 10.9/7.0 since it is unused (*/
271 CF_EXPORT
const CFStringRef _kCFURLVolumeMountPointStringKey
CF_AVAILABLE(10_6
, 4_0
);
272 /* the volume mountpoint string (Read-only, value type CFString) */
274 CF_EXPORT
const CFStringRef _kCFURLCompleteMountURLKey
CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
275 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the kCFURLVolumeURLForRemountingKey or NSURLVolumeURLForRemountingKey public property keys */
277 CF_EXPORT
const CFStringRef _kCFURLUbiquitousItemDownloadRequestedKey
CF_AVAILABLE(10_9
, 7_0
);
278 /* Is this Ubiquity item scheduled for download? (this is also true for items that are already downloaded). Use startDownloadingUbiquitousItemAtURL:error: to make this true (Read-only, value type CFBoolean) */
280 CF_EXPORT
const CFStringRef _kCFURLCloudDocsPlaceholderDictionaryKey
CF_AVAILABLE(10_10
, 8_0
);
281 /* Returns the placeholder dictionary for a side-fault file (Read-only, value type CFDictionary) */
283 CF_EXPORT
const CFStringRef _kCFURLCloudDocsPlaceholderLogicalNameKey
CF_AVAILABLE(10_10
, 8_0
);
284 /* Returns the placeholder dictionary for a side-fault file (Read-only, value type CFString) */
286 // Temporary holding place for future API.
288 CF_EXPORT
const CFStringRef kCFURLUbiquitousItemDownloadRequestedKey
CF_AVAILABLE(10_9
, 7_0
);
289 /* Is this Ubiquity item scheduled for download? (this is also true for items that are already downloaded). Use startDownloadingUbiquitousItemAtURL:error: to make this true (Read-only, value type CFBoolean) */
291 CF_EXPORT
const CFStringRef kCFURLUbiquitousItemContainerDisplayNameKey
CF_AVAILABLE(10_10
, 8_0
);
292 /* Returns the localized name of the ubiquity container that contains this item (Read-only, value type CFString) */
294 // these keys are defined here, not in CFURL.h, because they return NSImage values which can only be used by Foundation
295 CF_EXPORT
const CFStringRef kCFURLThumbnailDictionaryKey
CF_AVAILABLE(10_10
, 8_0
);
296 CF_EXPORT
const CFStringRef kCFURLThumbnailKey
CF_AVAILABLE(10_10
, 8_0
);
297 // The values of thumbnails in the dictionary returned by NSURLThumbnailDictionaryKey
298 CF_EXPORT
const CFStringRef kCFThumbnail1024x1024SizeKey
CF_AVAILABLE(10_10
, 8_0
);
302 Some common boolean properties can be accessed as a bitfield
303 for better performance -- see _CFURLGetResourcePropertyFlags() and
304 _CFURLCopyResourcePropertyValuesAndFlags(), below.
307 kCFURLResourceIsRegularFile
= 0x00000001,
308 kCFURLResourceIsDirectory
= 0x00000002,
309 kCFURLResourceIsSymbolicLink
= 0x00000004,
310 kCFURLResourceIsVolume
= 0x00000008,
311 kCFURLResourceIsPackage
= 0x00000010,
312 kCFURLResourceIsSystemImmutable
= 0x00000020,
313 kCFURLResourceIsUserImmutable
= 0x00000040,
314 kCFURLResourceIsHidden
= 0x00000080,
315 kCFURLResourceHasHiddenExtension
= 0x00000100,
316 kCFURLResourceIsApplication
= 0x00000200,
317 kCFURLResourceIsCompressed
= 0x00000400,
318 kCFURLResourceIsSystemCompressed
CF_ENUM_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
)
319 = 0x00000400, /* Deprecated and scheduled for removal in 10.10/8.0 - Use kCFURLResourceIsCompressed */
320 kCFURLCanSetHiddenExtension
= 0x00000800,
321 kCFURLResourceIsReadable
= 0x00001000,
322 kCFURLResourceIsWriteable
= 0x00002000,
323 kCFURLResourceIsExecutable
= 0x00004000, /* execute files or search directories */
324 kCFURLIsAliasFile
= 0x00008000,
325 kCFURLIsMountTrigger
= 0x00010000,
327 typedef unsigned long long CFURLResourcePropertyFlags
;
331 _CFURLGetResourceFlags - Returns a bit array of resource flags in the "flags"
332 output parameter. Only flags whose corresponding bits are set in the "mask" parameter
333 are valid in the output bit array. Returns true on success, false if an error occurs.
334 Optional output error: the error is set to a valid CFErrorRef if and only if the function
335 returns false. A valid output error must be released by the caller.
338 Boolean
_CFURLGetResourcePropertyFlags(CFURLRef url
, CFURLResourcePropertyFlags mask
, CFURLResourcePropertyFlags
*flags
, CFErrorRef
*error
) CF_AVAILABLE(10_6
, 4_0
);
342 File resource properties which can be obtained with _CFURLCopyFilePropertyValuesAndFlags().
344 typedef CF_OPTIONS(unsigned long long, CFURLFilePropertyBitmap
) {
345 kCFURLName
= 0x0000000000000001,
346 kCFURLLinkCount
= 0x0000000000000002,
347 kCFURLVolumeIdentifier
= 0x0000000000000004,
348 kCFURLObjectIdentifier
= 0x0000000000000008,
349 kCFURLCreationDate
= 0x0000000000000010,
350 kCFURLContentModificationDate
= 0x0000000000000020,
351 kCFURLAttributeModificationDate
= 0x0000000000000040,
352 kCFURLFileSize
= 0x0000000000000080,
353 kCFURLFileAllocatedSize
= 0x0000000000000100,
354 kCFURLFileSizeOfResourceFork
= 0x0000000000000200,
355 kCFURLFileAllocatedSizeOfResourceFork
= 0x0000000000000400,
356 kCFURLFinderInfo
= 0x0000000000000800,
357 kCFURLFileSecurity
= 0x0000000000001000,
361 The structure where _CFURLCopyFilePropertyValuesAndFlags() returns file resource properties.
363 struct _CFURLFilePropertyValues
{
364 CFStringRef name
; /* you are responsible for releasing this if you ask for it and get it */
366 uint64_t volumeIdentifier
;
367 uint64_t objectIdentifier
;
368 CFAbsoluteTime creationDate
;
369 CFAbsoluteTime contentModificationDate
;
370 CFAbsoluteTime attributeModificationDate
;
372 uint64_t fileAllocatedSize
;
373 uint64_t fileSizeOfResourceFork
;
374 uint64_t fileAllocatedSizeOfResourceFork
;
375 uint8_t finderInfo
[32];
376 CFFileSecurityRef fileSecurity
; /* you are responsible for releasing this if you ask for it and get it */
378 typedef struct _CFURLFilePropertyValues _CFURLFilePropertyValues
;
381 _CFURLCopyResourcePropertyValuesAndFlags - Returns property values as simple types
382 whenever possible. Returns a bit array of resource flags in the "flags"
383 output parameter. Only flags whose corresponding bits are set in the "mask" parameter
384 are valid in the output bit array. Returns true on success, false if an error occurs.
385 Optional output error: the error is set to a valid CFErrorRef if and only if the function
386 returns false. A valid output error must be released by the caller.
389 Boolean
_CFURLCopyResourcePropertyValuesAndFlags( CFURLRef url
, CFURLFilePropertyBitmap requestProperties
, CFURLFilePropertyBitmap
*actualProperties
, struct _CFURLFilePropertyValues
*properties
, CFURLResourcePropertyFlags propertyFlagsMask
, CFURLResourcePropertyFlags
*propertyFlags
, CFErrorRef
*error
) CF_AVAILABLE(10_7
, 4_0
);
392 Volume property flags
394 typedef CF_OPTIONS(unsigned long long, CFURLVolumePropertyFlags
) {
395 kCFURLVolumeIsLocal
= 0x1LL
, // Local device (vs. network device)
396 kCFURLVolumeIsAutomount
= 0x2LL
, // Mounted by the automounter
397 kCFURLVolumeDontBrowse
= 0x4LL
, // Hidden from user browsing
398 kCFURLVolumeIsReadOnly
= 0x8LL
, // Mounted read-only
399 kCFURLVolumeIsQuarantined
= 0x10LL
, // Mounted with quarantine bit
400 kCFURLVolumeIsEjectable
= 0x20LL
,
401 kCFURLVolumeIsRemovable
= 0x40LL
,
402 kCFURLVolumeIsInternal
= 0x80LL
,
403 kCFURLVolumeIsExternal
= 0x100LL
,
404 kCFURLVolumeIsDiskImage
= 0x200LL
,
405 kCFURLVolumeIsFileVault
= 0x400LL
,
406 kCFURLVolumeIsLocaliDiskMirror
CF_ENUM_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
)
407 = 0x800LL
, // Deprecated and scheduled for removal in 10.10/8.0 - there are no more iDisks
408 kCFURLVolumeIsiPod
= 0x1000LL
,
409 kCFURLVolumeIsiDisk
CF_ENUM_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
)
410 = 0x2000LL
, // Deprecated and scheduled for removal in 10.10/8.0 - there are no more iDisks
411 kCFURLVolumeIsCD
= 0x4000LL
,
412 kCFURLVolumeIsDVD
= 0x8000LL
,
413 kCFURLVolumeIsDeviceFileSystem
= 0x10000LL
,
414 kCFURLVolumeIsTimeMachine
CF_ENUM_AVAILABLE_MAC(10_9
)
416 kCFURLVolumeIsAirport
CF_ENUM_AVAILABLE_MAC(10_9
)
418 kCFURLVolumeIsVideoDisk
CF_ENUM_AVAILABLE_MAC(10_9
)
420 kCFURLVolumeIsDVDVideo
CF_ENUM_AVAILABLE_MAC(10_9
)
422 kCFURLVolumeIsBDVideo
CF_ENUM_AVAILABLE_MAC(10_9
)
424 kCFURLVolumeIsMobileTimeMachine
CF_ENUM_AVAILABLE_MAC(10_9
)
426 kCFURLVolumeIsNetworkOptical
CF_ENUM_AVAILABLE_MAC(10_9
)
428 kCFURLVolumeIsBeingRepaired
CF_ENUM_AVAILABLE_MAC(10_9
)
430 kCFURLVolumeIsBeingUnmounted
CF_ENUM_AVAILABLE_MAC(10_9
)
433 // IMPORTANT: The values of the following flags must stay in sync with the
434 // VolumeCapabilities flags in CarbonCore (FileIDTreeStorage.h)
435 kCFURLVolumeSupportsPersistentIDs
= 0x100000000LL
,
436 kCFURLVolumeSupportsSearchFS
= 0x200000000LL
,
437 kCFURLVolumeSupportsExchange
= 0x400000000LL
,
438 // reserved 0x800000000LL,
439 kCFURLVolumeSupportsSymbolicLinks
= 0x1000000000LL
,
440 kCFURLVolumeSupportsDenyModes
= 0x2000000000LL
,
441 kCFURLVolumeSupportsCopyFile
= 0x4000000000LL
,
442 kCFURLVolumeSupportsReadDirAttr
= 0x8000000000LL
,
443 kCFURLVolumeSupportsJournaling
= 0x10000000000LL
,
444 kCFURLVolumeSupportsRename
= 0x20000000000LL
,
445 kCFURLVolumeSupportsFastStatFS
= 0x40000000000LL
,
446 kCFURLVolumeSupportsCaseSensitiveNames
= 0x80000000000LL
,
447 kCFURLVolumeSupportsCasePreservedNames
= 0x100000000000LL
,
448 kCFURLVolumeSupportsFLock
= 0x200000000000LL
,
449 kCFURLVolumeHasNoRootDirectoryTimes
= 0x400000000000LL
,
450 kCFURLVolumeSupportsExtendedSecurity
= 0x800000000000LL
,
451 kCFURLVolumeSupports2TBFileSize
= 0x1000000000000LL
,
452 kCFURLVolumeSupportsHardLinks
= 0x2000000000000LL
,
453 kCFURLVolumeSupportsMandatoryByteRangeLocks
= 0x4000000000000LL
,
454 kCFURLVolumeSupportsPathFromID
= 0x8000000000000LL
,
455 // reserved 0x10000000000000LL,
456 kCFURLVolumeIsJournaling
= 0x20000000000000LL
,
457 kCFURLVolumeSupportsSparseFiles
= 0x40000000000000LL
,
458 kCFURLVolumeSupportsZeroRuns
= 0x80000000000000LL
,
459 kCFURLVolumeSupportsVolumeSizes
= 0x100000000000000LL
,
460 kCFURLVolumeSupportsRemoteEvents
= 0x200000000000000LL
,
461 kCFURLVolumeSupportsHiddenFiles
= 0x400000000000000LL
,
462 kCFURLVolumeSupportsDecmpFSCompression
= 0x800000000000000LL
,
463 kCFURLVolumeHas64BitObjectIDs
= 0x1000000000000000LL
,
464 kCFURLVolumePropertyFlagsAll
= 0xffffffffffffffffLL
469 _CFURLGetVolumePropertyFlags - Returns a bit array of volume properties.
470 Only flags whose corresponding bits are set in the "mask" parameter are valid
471 in the output bit array. Returns true on success, false if an error occurs.
472 Optional output error: the error is set to a valid CFErrorRef if and only if the function
473 returns false. A valid output error must be released by the caller.
476 Boolean
_CFURLGetVolumePropertyFlags(CFURLRef url
, CFURLVolumePropertyFlags mask
, CFURLVolumePropertyFlags
*flags
, CFErrorRef
*error
) CF_AVAILABLE(10_6
, 4_0
);
479 /* _CFURLCopyResourcePropertyForKeyFromCache works like CFURLCopyResourcePropertyForKey
480 only it never causes I/O. If the property value requested is cached (or known
481 to be not available) for the resource, return TRUE and the property value. The
482 property value returned could be NULL meaning that property is not available
483 for the resource. If the property value requested is not cached or the resource,
486 Only for use by DesktopServices!
489 Boolean
_CFURLCopyResourcePropertyForKeyFromCache(CFURLRef url
, CFStringRef key
, void *cfTypeRefValue
) CF_AVAILABLE(10_8
, NA
);
491 /* _CFURLCopyResourcePropertiesForKeysFromCache works like CFURLCopyResourcePropertiesForKeys
492 only it never causes I/O. If the property values requested are cached (or known
493 to be not available) for the resource, return a CFDictionary. Property values
494 not available for the resource are not included in the CFDictionary.
495 If the values requested are not cached, return NULL.
497 Only for use by DesktopServices!
500 CFDictionaryRef
_CFURLCopyResourcePropertiesForKeysFromCache(CFURLRef url
, CFArrayRef keys
) CF_AVAILABLE(10_8
, NA
);
502 /* _CFURLCacheResourcePropertyForKey works like CFURLCopyResourcePropertyForKey
503 only it does not return the property value -- it just ensures the value is cached.
504 If no errors occur, TRUE is returned. If an error occurs, FALSE is returned
505 and the optional output error is set to a valid CFErrorRef (which must be
506 released by the caller.
508 Only for use by DesktopServices!
511 Boolean
_CFURLCacheResourcePropertyForKey(CFURLRef url
, CFStringRef key
, CFErrorRef
*error
) CF_AVAILABLE(10_8
, NA
);
513 /* _CFURLCacheResourcePropertiesForKeys works like CFURLCopyResourcePropertiesForKeys
514 only it does not return the property values -- it just ensures the values is cached.
515 If no errors occur, TRUE is returned. If an error occurs, FALSE is returned
516 and the optional output error is set to a valid CFErrorRef (which must be
517 released by the caller.
519 Only for use by DesktopServices!
522 Boolean
_CFURLCacheResourcePropertiesForKeys(CFURLRef url
, CFArrayRef keys
, CFErrorRef
*error
) CF_AVAILABLE(10_8
, NA
);
525 _CFURLCreateDisplayPathComponentsArray()
528 _FileURLCreateDisplayPathComponentsArray creates a CFArray of
529 CFURLs for each component in the path leading up to the target
530 URL. This routine is suitable for clients who wish to show the
531 path leading up to a file system item. NOTE: This routine can be
532 I/O intensive, so use it sparingly, and cache the results if
536 The CFURLs in the result CFArray are ordered from the target URL
537 to the root of the display path. For example, if the target URL
538 is file://localhost/System/Library/ the CFURLs in the array will
539 be ordered: file://localhost/System/Library/,
540 file://localhost/System/, and then file://localhost/
548 A pointer to a CFErrorRef, or NULL. If error is non-NULL and
549 the function result is NULL, this will be filled in with a
550 CFErrorRef representing the error that occurred.
553 A CFArray or NULL if an error occurred.
556 CFArrayRef
_CFURLCreateDisplayPathComponentsArray(CFURLRef url
, CFErrorRef
*error
) CF_AVAILABLE(10_7
, 4_0
);
558 /* Returns true for URLs that locate file system resources. */
560 Boolean
_CFURLIsFileURL(CFURLRef url
) CF_AVAILABLE(10_6
, 4_0
);
562 /* Deprecated and scheduled for removal in 10.10/8.0 - Use the public API CFURLIsFileReferenceURL() */
564 Boolean
_CFURLIsFileReferenceURL(CFURLRef url
) CF_DEPRECATED(10_6
, 10_9
, 4_0
, 7_0
);
566 /* For use by Core Services */
568 void *__CFURLResourceInfoPtr(CFURLRef url
) CF_AVAILABLE(10_6
, 4_0
);
571 void __CFURLSetResourceInfoPtr(CFURLRef url
, void *ptr
) CF_AVAILABLE(10_6
, 4_0
);
574 struct FSCatalogInfo
;
577 /* _CFURLGetCatalogInfo is used by LaunchServices */
579 SInt32
_CFURLGetCatalogInfo(CFURLRef url
, UInt32 whichInfo
, struct FSCatalogInfo
*catalogInfo
, struct HFSUniStr255
*name
) CF_AVAILABLE(10_7
, 5_0
);
581 /* _CFURLReplaceObject SPI */
583 /* options for _CFURLReplaceObject */
585 // _CFURLItemReplacementUsingOriginalMetadataOnly = 1, // not used
586 _CFURLItemReplacementUsingNewMetadataOnly
= 2,
587 // _CFURLItemReplacementByMergingMetadata = 3, // not used
588 _CFURLItemReplacementWithoutDeletingBackupItem
= 1 << 4
591 /* _CFURLReplaceObject is the underlying implementation for -[NSFileManager replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error:] with one additional argument: newName. The optional newName argument can be used to rename the replacement (for example, when replacing "document.rtf" with "document.rtfd") while still preserving the document's metadata. If newName is used, there must be a file or directory at originalItemURL -- if originalItemURL does not exist and newName is not NULL, an error will be returned.
594 Boolean
_CFURLReplaceObject( CFAllocatorRef allocator
, CFURLRef originalItemURL
, CFURLRef newItemURL
, CFStringRef newName
, CFStringRef backupItemName
, CFOptionFlags options
, CFURLRef
*resultingURL
, CFErrorRef
*error
) CF_AVAILABLE(10_7
, 5_0
);
597 Boolean
_CFURLIsProtectedDirectory(CFURLRef directoryURL
) CF_AVAILABLE(10_10
, NA
);
599 /* _CFURLAttachSecurityScopeToFileURL attaches a sandbox extension to the file URL object. The URL object will then be security-scoped and will be usable with the NSURL's -startAccessingSecurityScopedResource method and CFURL's CFURLStartAccessingSecurityScopedResource() function. The URL object must be a file URL. If the URL object already has a sandbox extension attached, the new extension replaces the previous sandbox extension. If NULL is passed for the sandboxExtension, the sandbox extension (if any) is removed from the URL object. Callers would be responsible for ensuring the sandbox extension matches the URL's file system path.
602 void _CFURLAttachSecurityScopeToFileURL(CFURLRef url
, CFDataRef sandboxExtension
) CF_AVAILABLE(10_10
, 8_0
);
604 /* _CFURLCopySecurityScopeFromFileURL copies the sandbox extension attached to the file URL object. If the URL is not a file URL or doesn't have a sandbox extension, NULL will be returned.
607 CFDataRef
_CFURLCopySecurityScopeFromFileURL(CFURLRef url
) CF_AVAILABLE(10_10
, 8_0
);
610 void _CFURLSetPermanentResourcePropertyForKey(CFURLRef url
, CFStringRef key
, CFTypeRef propertyValue
) CF_AVAILABLE(10_10
, 8_0
);
613 CFURLEnumeratorResult
_CFURLEnumeratorGetURLsBulk(CFURLEnumeratorRef enumerator
, CFIndex maximumURLs
, CFIndex
*actualURLs
, CFURLRef
*urls
, CFErrorRef
*error
) CF_AVAILABLE(10_6
, 4_0
);
615 // Returns a string describing the bookmark data. For debugging purposes only.
617 CFStringRef
_CFURLBookmarkCopyDescription(CFDataRef bookmarkRef
) CF_AVAILABLE(10_10
, 8_0
);
619 // private CFURLBookmarkCreationOptions
621 kCFURLBookmarkCreationWithFileProvider
CF_ENUM_AVAILABLE(10_10
, 8_0
) = ( 1UL << 26 ), // private option to create bookmarks with file provider string. The file provider string overrides the rest of the bookmark data at resolution time.
622 kCFURLBookmarkOperatingInsideScopedBookmarksAgent
= (1UL << 27), // private option used internally by ScopedBookmarkAgent to prevent recursion between the agent and the framework code. Available 10_7, NA
623 kCFURLBookmarkCreationAllowCreationIfResourceDoesNotExistMask
= ( 1UL << 28 ), // allow creation of a bookmark to a file: scheme with a CFURLRef of item which may not exist. If the filesystem item does not exist, the created bookmark contains essentially no properties beyond the url string. Available 10_7, 5_0.
624 kCFURLBookmarkCreationDoNotIncludeSandboxExtensionsMask
= ( 1UL << 29 ), // If set, sandbox extensions are not included in created bookmarks. Ordinarily, bookmarks (except those created suitable for putting into a bookmark file) will have a sandbox extension added for the item. Available 10_7, NA.
625 kCFURLBookmarkCreationSuitableForOdocAppleEvent
= ( 1UL << 31 ), // add properties we guarantee will be in an odoc AppleEvent. Available 10_10, NA (but supported back to 10.6).
628 // private CFURLBookmarkFileCreationOptions
630 // FIXME: These three options (kCFBookmarkFileCreationWithoutOverwritingExistingFile, kCFBookmarkFileCreationWithoutAppendingAliasExtension, and kCFBookmarkFileCreationWithoutCreatingResourceFork) are not implemented and have never been used.
631 kCFBookmarkFileCreationWithoutOverwritingExistingFile
= ( 1UL << 8 ), // if destination file already exists don't overwrite it and return an error
632 kCFBookmarkFileCreationWithoutAppendingAliasExtension
= ( 1UL << 9 ), // don't add / change whatever extension is on the created alias file
633 kCFBookmarkFileCreationWithoutCreatingResourceFork
= ( 1UL << 10 ), // don't create the resource-fork half of the alias file
636 // private CFURLBookmarkResolutionOptions
638 kCFBookmarkResolutionPerformRelativeResolutionFirstMask
CF_ENUM_AVAILABLE(10_8
, 6_0
) = ( 1UL << 11 ), // perform relative resolution before absolute resolution. If this bit is set, for this to be useful a relative URL must also have been passed in and the bookmark when created must have been created relative to another url.
641 typedef CF_ENUM(CFIndex
, CFURLBookmarkMatchResult
) {
642 kCFURLBookmarkComparisonUnableToCompare
= 0x00000000, /* the two bookmarks could not be compared for some reason */
643 kCFURLBookmarkComparisonNoMatch
= 0x00001000, /* Bookmarks do not refer to the same item */
644 kCFURLBookmarkComparisonUnlikelyToMatch
= 0x00002000, /* it is unlikely that the two items refer to the same filesystem item */
645 kCFURLBookmarkComparisonLikelyToMatch
= 0x00004000, /* it is likely that the two items refer to the same filesystem item ( but, they may not ) */
646 kCFURLBookmarkComparisonMatch
= 0x00008000, /* the two items refer to the same item, but other information in the bookmarks may not match */
647 kCFURLBookmarkComparisonExactMatch
= 0x0000f000 /* the two bookmarks are identical */
648 }; // Available 10_7, NA.
650 /* The relativeToURL and matchingPropertyKeys parameters are not used and are ignored */
652 CFURLBookmarkMatchResult
_CFURLBookmarkDataCompare(CFDataRef bookmark1Ref
, CFDataRef bookmark2Ref
, CFURLRef relativeToURL
, CFArrayRef
* matchingPropertyKeys
) CF_AVAILABLE(10_7
, NA
);
655 OSStatus
_CFURLBookmarkDataToAliasHandle(CFDataRef bookmarkRef
, void* aliasHandleP
) CF_AVAILABLE(10_7
, NA
);
658 CFURLRef
_CFURLCreateByResolvingAliasFile(CFAllocatorRef allocator
, CFURLRef url
, CFURLBookmarkResolutionOptions options
, CFArrayRef propertiesToInclude
, CFErrorRef
*error
) CF_AVAILABLE(10_10
, 8_0
);
661 The following are properties that can be asked of bookmark data objects in addition to the resource properties
665 extern const CFStringRef kCFURLBookmarkOriginalPathKey
CF_AVAILABLE(10_7
, 5_0
);
666 extern const CFStringRef kCFURLBookmarkOriginalRelativePathKey
CF_AVAILABLE(10_7
, 5_0
);
667 extern const CFStringRef kCFURLBookmarkOriginalRelativePathComponentsArrayKey
CF_AVAILABLE(10_7
, 5_0
);
668 extern const CFStringRef kCFURLBookmarkOriginalVolumeNameKey
CF_AVAILABLE(10_7
, 5_0
);
669 extern const CFStringRef kCFURLBookmarkOriginalVolumeCreationDateKey
CF_AVAILABLE(10_7
, 5_0
);
670 extern const CFStringRef kCFURLBookmarkFileProviderStringKey
CF_AVAILABLE(10_10
, 8_0
);
674 #endif /* ! __COREFOUNDATION_CFURLPRIV__ */