1{ Parsed from Foundation.framework NSFileManager.h }
2
3
4{ Types from NSFileManager }
5{$ifdef TYPES}
6
7{$endif}
8
9
10{$ifdef TYPES}
11type
12  NSFileManagerPtr = ^NSFileManager;
13  NSDirectoryEnumeratorPtr = ^NSDirectoryEnumerator;
14  NSFileManagerDelegateProtocolPtr = ^NSFileManagerDelegateProtocol;
15{$endif}
16
17{$ifdef TYPES}
18const
19  NSFoundationVersionWithFileManagerResourceForkSupport = 412;
20
21type
22  NSVolumeEnumerationOptions = NSUInteger;
23  NSVolumeEnumerationOptionsPtr = ^NSVolumeEnumerationOptions;
24
25const
26  NSVolumeEnumerationSkipHiddenVolumes = 1 shl 1;
27  NSVolumeEnumerationProduceFileReferenceURLs = 1 shl 2;
28
29type
30  NSDirectoryEnumerationOptions = NSUInteger;
31  NSDirectoryEnumerationOptionsPtr = ^NSDirectoryEnumerationOptions;
32
33const
34  NSDirectoryEnumerationSkipsSubdirectoryDescendants = 1 shl 0;
35  NSDirectoryEnumerationSkipsPackageDescendants = 1 shl 1;
36  NSDirectoryEnumerationSkipsHiddenFiles = 1 shl 2;
37
38type
39  NSFileManagerItemReplacementOptions = NSUInteger;
40  NSFileManagerItemReplacementOptionsPtr = ^NSFileManagerItemReplacementOptions;
41
42const
43  NSFileManagerItemReplacementUsingNewMetadataOnly = 1 shl 0;
44  NSFileManagerItemReplacementWithoutDeletingBackupItem = 1 shl 1;
45
46type
47  NSURLRelationship = NSInteger;
48  NSURLRelationshipPtr = ^NSURLRelationship;
49
50const
51  NSURLRelationshipContains = 0;
52  NSURLRelationshipSame = 1;
53  NSURLRelationshipOther = 2;
54{$endif}
55
56{$ifdef EXTERNAL_SYMBOLS}
57var
58  NSUbiquityIdentityDidChangeNotification: NSString { available in 10_8, 6_0 }; cvar; external;
59{$endif}
60
61{$ifdef CLASSES}
62
63type
64  NSFileManager = objcclass external (NSObject)
65  public
66    class function defaultManager: NSFileManager; message 'defaultManager';
67    function mountedVolumeURLsIncludingResourceValuesForKeys_options (propertyKeys: NSArray; options: NSVolumeEnumerationOptions): NSArray; message 'mountedVolumeURLsIncludingResourceValuesForKeys:options:'; { available in 10_6, 4_0 }
68    function contentsOfDirectoryAtURL_includingPropertiesForKeys_options_error (url: NSURL; keys: NSArray; mask: NSDirectoryEnumerationOptions; error: NSErrorPtr): NSArray; message 'contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:'; { available in 10_6, 4_0 }
69    function URLsForDirectory_inDomains (directory: NSSearchPathDirectory; domainMask: NSSearchPathDomainMask): NSArray; message 'URLsForDirectory:inDomains:'; { available in 10_6, 4_0 }
70    function URLForDirectory_inDomain_appropriateForURL_create_error (directory: NSSearchPathDirectory; domain: NSSearchPathDomainMask; url: NSURL; shouldCreate: ObjCBOOL; error: NSErrorPtr): NSURL; message 'URLForDirectory:inDomain:appropriateForURL:create:error:'; { available in 10_6, 4_0 }
71    function getRelationship_ofDirectoryAtURL_toItemAtURL_error (outRelationship: NSURLRelationshipPtr; directoryURL: NSURL; otherURL: NSURL; error: NSErrorPtr): ObjCBOOL; message 'getRelationship:ofDirectoryAtURL:toItemAtURL:error:'; { available in 10_10, 8_0 }
72    function getRelationship_ofDirectory_inDomain_toItemAtURL_error (outRelationship: NSURLRelationshipPtr; directory: NSSearchPathDirectory; domainMask: NSSearchPathDomainMask; url: NSURL; error: NSErrorPtr): ObjCBOOL; message 'getRelationship:ofDirectory:inDomain:toItemAtURL:error:'; { available in 10_10, 8_0 }
73    function createDirectoryAtURL_withIntermediateDirectories_attributes_error (url: NSURL; createIntermediates: ObjCBOOL; attributes: NSDictionary; error: NSErrorPtr): ObjCBOOL; message 'createDirectoryAtURL:withIntermediateDirectories:attributes:error:'; { available in 10_7, 5_0 }
74    function createSymbolicLinkAtURL_withDestinationURL_error (url: NSURL; destURL: NSURL; error: NSErrorPtr): ObjCBOOL; message 'createSymbolicLinkAtURL:withDestinationURL:error:'; { available in 10_7, 5_0 }
75    procedure setDelegate(newValue: NSFileManagerDelegateProtocol); message 'setDelegate:';
76    function delegate: NSFileManagerDelegateProtocol; message 'delegate';
77    function setAttributes_ofItemAtPath_error (attributes: NSDictionary; path: NSString; error: NSErrorPtr): ObjCBOOL; message 'setAttributes:ofItemAtPath:error:'; { available in 10_5, 2_0 }
78    function createDirectoryAtPath_withIntermediateDirectories_attributes_error (path: NSString; createIntermediates: ObjCBOOL; attributes: NSDictionary; error: NSErrorPtr): ObjCBOOL; message 'createDirectoryAtPath:withIntermediateDirectories:attributes:error:'; { available in 10_5, 2_0 }
79    function contentsOfDirectoryAtPath_error (path: NSString; error: NSErrorPtr): NSArray; message 'contentsOfDirectoryAtPath:error:'; { available in 10_5, 2_0 }
80    function subpathsOfDirectoryAtPath_error (path: NSString; error: NSErrorPtr): NSArray; message 'subpathsOfDirectoryAtPath:error:'; { available in 10_5, 2_0 }
81    function attributesOfItemAtPath_error (path: NSString; error: NSErrorPtr): NSDictionary; message 'attributesOfItemAtPath:error:'; { available in 10_5, 2_0 }
82    function attributesOfFileSystemForPath_error (path: NSString; error: NSErrorPtr): NSDictionary; message 'attributesOfFileSystemForPath:error:'; { available in 10_5, 2_0 }
83    function createSymbolicLinkAtPath_withDestinationPath_error (path: NSString; destPath: NSString; error: NSErrorPtr): ObjCBOOL; message 'createSymbolicLinkAtPath:withDestinationPath:error:'; { available in 10_5, 2_0 }
84    function destinationOfSymbolicLinkAtPath_error (path: NSString; error: NSErrorPtr): NSString; message 'destinationOfSymbolicLinkAtPath:error:'; { available in 10_5, 2_0 }
85    function copyItemAtPath_toPath_error (srcPath: NSString; dstPath: NSString; error: NSErrorPtr): ObjCBOOL; message 'copyItemAtPath:toPath:error:'; { available in 10_5, 2_0 }
86    function moveItemAtPath_toPath_error (srcPath: NSString; dstPath: NSString; error: NSErrorPtr): ObjCBOOL; message 'moveItemAtPath:toPath:error:'; { available in 10_5, 2_0 }
87    function linkItemAtPath_toPath_error (srcPath: NSString; dstPath: NSString; error: NSErrorPtr): ObjCBOOL; message 'linkItemAtPath:toPath:error:'; { available in 10_5, 2_0 }
88    function removeItemAtPath_error (path: NSString; error: NSErrorPtr): ObjCBOOL; message 'removeItemAtPath:error:'; { available in 10_5, 2_0 }
89    function copyItemAtURL_toURL_error (srcURL: NSURL; dstURL: NSURL; error: NSErrorPtr): ObjCBOOL; message 'copyItemAtURL:toURL:error:'; { available in 10_6, 4_0 }
90    function moveItemAtURL_toURL_error (srcURL: NSURL; dstURL: NSURL; error: NSErrorPtr): ObjCBOOL; message 'moveItemAtURL:toURL:error:'; { available in 10_6, 4_0 }
91    function linkItemAtURL_toURL_error (srcURL: NSURL; dstURL: NSURL; error: NSErrorPtr): ObjCBOOL; message 'linkItemAtURL:toURL:error:'; { available in 10_6, 4_0 }
92    function removeItemAtURL_error (URL: NSURL; error: NSErrorPtr): ObjCBOOL; message 'removeItemAtURL:error:'; { available in 10_6, 4_0 }
93    function trashItemAtURL_resultingItemURL_error (url: NSURL; outResultingURL: NSURLPtr; error: NSErrorPtr): ObjCBOOL; message 'trashItemAtURL:resultingItemURL:error:'; { available in 10_8 }
94    function fileAttributesAtPath_traverseLink (path: NSString; yorn: ObjCBOOL): NSDictionary; message 'fileAttributesAtPath:traverseLink:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
95    function changeFileAttributes_atPath (attributes: NSDictionary; path: NSString): ObjCBOOL; message 'changeFileAttributes:atPath:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
96    function directoryContentsAtPath (path: NSString): NSArray; message 'directoryContentsAtPath:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
97    function fileSystemAttributesAtPath (path: NSString): NSDictionary; message 'fileSystemAttributesAtPath:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
98    function pathContentOfSymbolicLinkAtPath (path: NSString): NSString; message 'pathContentOfSymbolicLinkAtPath:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
99    function createSymbolicLinkAtPath_pathContent (path: NSString; otherpath: NSString): ObjCBOOL; message 'createSymbolicLinkAtPath:pathContent:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
100    function createDirectoryAtPath_attributes (path: NSString; attributes: NSDictionary): ObjCBOOL; message 'createDirectoryAtPath:attributes:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
101    {$if (defined(TARGET_OS_MAC) and not (defined(TARGET_OS_EMBEDDED) or defined(TARGET_OS_IPHONE))) or defined(TARGET_OS_WIN32)}
102    function linkPath_toPath_handler (src: NSString; dest: NSString; handler: id): ObjCBOOL; message 'linkPath:toPath:handler:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
103    function copyPath_toPath_handler (src: NSString; dest: NSString; handler: id): ObjCBOOL; message 'copyPath:toPath:handler:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
104    function movePath_toPath_handler (src: NSString; dest: NSString; handler: id): ObjCBOOL; message 'movePath:toPath:handler:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
105    function removeFileAtPath_handler (path: NSString; handler: id): ObjCBOOL; message 'removeFileAtPath:handler:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
106    {$endif}
107    function currentDirectoryPath: NSString; message 'currentDirectoryPath';
108    function changeCurrentDirectoryPath (path: NSString): ObjCBOOL; message 'changeCurrentDirectoryPath:';
109    function fileExistsAtPath (path: NSString): ObjCBOOL; message 'fileExistsAtPath:';
110    function fileExistsAtPath_isDirectory (path: NSString; isDirectory: pObjCBOOL): ObjCBOOL; message 'fileExistsAtPath:isDirectory:';
111    function isReadableFileAtPath (path: NSString): ObjCBOOL; message 'isReadableFileAtPath:';
112    function isWritableFileAtPath (path: NSString): ObjCBOOL; message 'isWritableFileAtPath:';
113    function isExecutableFileAtPath (path: NSString): ObjCBOOL; message 'isExecutableFileAtPath:';
114    function isDeletableFileAtPath (path: NSString): ObjCBOOL; message 'isDeletableFileAtPath:';
115    function contentsEqualAtPath_andPath (path1: NSString; path2: NSString): ObjCBOOL; message 'contentsEqualAtPath:andPath:';
116    function displayNameAtPath (path: NSString): NSString; message 'displayNameAtPath:';
117    function componentsToDisplayForPath (path: NSString): NSArray; message 'componentsToDisplayForPath:';
118    function enumeratorAtPath (path: NSString): NSDirectoryEnumerator; message 'enumeratorAtPath:';
119    function enumeratorAtURL_includingPropertiesForKeys_options_errorHandler (url: NSURL; keys: NSArray; mask: NSDirectoryEnumerationOptions; handler: OpaqueCBlock): NSDirectoryEnumerator; message 'enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:'; { available in 10_6, 4_0 }
120    function subpathsAtPath (path: NSString): NSArray; message 'subpathsAtPath:';
121    function contentsAtPath (path: NSString): NSData; message 'contentsAtPath:';
122    function createFileAtPath_contents_attributes (path: NSString; data: NSData; attr: NSDictionary): ObjCBOOL; message 'createFileAtPath:contents:attributes:';
123    function fileSystemRepresentationWithPath (path: NSString): PChar; message 'fileSystemRepresentationWithPath:';
124    function stringWithFileSystemRepresentation_length (str: PChar; len: NSUInteger): NSString; message 'stringWithFileSystemRepresentation:length:';
125    function replaceItemAtURL_withItemAtURL_backupItemName_options_resultingItemURL_error (originalItemURL: NSURL; newItemURL: NSURL; backupItemName: NSString; options: NSFileManagerItemReplacementOptions; resultingURL: NSURLPtr; error: NSErrorPtr): ObjCBOOL; message 'replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error:'; { available in 10_6, 4_0 }
126    function setUbiquitous_itemAtURL_destinationURL_error (flag: ObjCBOOL; url: NSURL; destinationURL: NSURL; error: NSErrorPtr): ObjCBOOL; message 'setUbiquitous:itemAtURL:destinationURL:error:'; { available in 10_7, 5_0 }
127    function isUbiquitousItemAtURL (url: NSURL): ObjCBOOL; message 'isUbiquitousItemAtURL:'; { available in 10_7, 5_0 }
128    function startDownloadingUbiquitousItemAtURL_error (url: NSURL; error: NSErrorPtr): ObjCBOOL; message 'startDownloadingUbiquitousItemAtURL:error:'; { available in 10_7, 5_0 }
129    function evictUbiquitousItemAtURL_error (url: NSURL; error: NSErrorPtr): ObjCBOOL; message 'evictUbiquitousItemAtURL:error:'; { available in 10_7, 5_0 }
130    function URLForUbiquityContainerIdentifier (containerIdentifier: NSString): NSURL; message 'URLForUbiquityContainerIdentifier:'; { available in 10_7, 5_0 }
131    function URLForPublishingUbiquitousItemAtURL_expirationDate_error (url: NSURL; outDate: NSDatePtr; error: NSErrorPtr): NSURL; message 'URLForPublishingUbiquitousItemAtURL:expirationDate:error:'; { available in 10_7, 5_0 }
132    function ubiquityIdentityToken: id; message 'ubiquityIdentityToken';
133    function containerURLForSecurityApplicationGroupIdentifier (groupIdentifier: NSString): NSURL; message 'containerURLForSecurityApplicationGroupIdentifier:'; { available in 10_8, 7_0 }
134  end;
135
136
137type
138  NSCopyLinkMoveHandler = objccategory external (NSObject)
139    function fileManager_shouldProceedAfterError (fm: NSFileManager; errorInfo: NSDictionary): ObjCBOOL; message 'fileManager:shouldProceedAfterError:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
140    procedure fileManager_willProcessPath (fm: NSFileManager; path: NSString); message 'fileManager:willProcessPath:'; deprecated 'in 10_0, 10_5, 2_0, 2_0';
141  end;
142{$endif}
143
144{$ifdef PROTOCOLS}
145
146type
147  NSFileManagerDelegateProtocol = objcprotocol external name 'NSFileManagerDelegate' (NSObjectProtocol)
148  optional
149    function fileManager_shouldCopyItemAtPath_toPath (fileManager: NSFileManager; srcPath: NSString; dstPath: NSString): ObjCBOOL; message 'fileManager:shouldCopyItemAtPath:toPath:';
150    function fileManager_shouldCopyItemAtURL_toURL (fileManager: NSFileManager; srcURL: NSURL; dstURL: NSURL): ObjCBOOL; message 'fileManager:shouldCopyItemAtURL:toURL:'; { available in 10_6, 4_0 }
151    function fileManager_shouldProceedAfterError_copyingItemAtPath_toPath (fileManager: NSFileManager; error: NSError; srcPath: NSString; dstPath: NSString): ObjCBOOL; message 'fileManager:shouldProceedAfterError:copyingItemAtPath:toPath:';
152    function fileManager_shouldProceedAfterError_copyingItemAtURL_toURL (fileManager: NSFileManager; error: NSError; srcURL: NSURL; dstURL: NSURL): ObjCBOOL; message 'fileManager:shouldProceedAfterError:copyingItemAtURL:toURL:'; { available in 10_6, 4_0 }
153    function fileManager_shouldMoveItemAtPath_toPath (fileManager: NSFileManager; srcPath: NSString; dstPath: NSString): ObjCBOOL; message 'fileManager:shouldMoveItemAtPath:toPath:';
154    function fileManager_shouldMoveItemAtURL_toURL (fileManager: NSFileManager; srcURL: NSURL; dstURL: NSURL): ObjCBOOL; message 'fileManager:shouldMoveItemAtURL:toURL:'; { available in 10_6, 4_0 }
155    function fileManager_shouldProceedAfterError_movingItemAtPath_toPath (fileManager: NSFileManager; error: NSError; srcPath: NSString; dstPath: NSString): ObjCBOOL; message 'fileManager:shouldProceedAfterError:movingItemAtPath:toPath:';
156    function fileManager_shouldProceedAfterError_movingItemAtURL_toURL (fileManager: NSFileManager; error: NSError; srcURL: NSURL; dstURL: NSURL): ObjCBOOL; message 'fileManager:shouldProceedAfterError:movingItemAtURL:toURL:'; { available in 10_6, 4_0 }
157    function fileManager_shouldLinkItemAtPath_toPath (fileManager: NSFileManager; srcPath: NSString; dstPath: NSString): ObjCBOOL; message 'fileManager:shouldLinkItemAtPath:toPath:';
158    function fileManager_shouldLinkItemAtURL_toURL (fileManager: NSFileManager; srcURL: NSURL; dstURL: NSURL): ObjCBOOL; message 'fileManager:shouldLinkItemAtURL:toURL:'; { available in 10_6, 4_0 }
159    function fileManager_shouldProceedAfterError_linkingItemAtPath_toPath (fileManager: NSFileManager; error: NSError; srcPath: NSString; dstPath: NSString): ObjCBOOL; message 'fileManager:shouldProceedAfterError:linkingItemAtPath:toPath:';
160    function fileManager_shouldProceedAfterError_linkingItemAtURL_toURL (fileManager: NSFileManager; error: NSError; srcURL: NSURL; dstURL: NSURL): ObjCBOOL; message 'fileManager:shouldProceedAfterError:linkingItemAtURL:toURL:'; { available in 10_6, 4_0 }
161    function fileManager_shouldRemoveItemAtPath (fileManager: NSFileManager; path: NSString): ObjCBOOL; message 'fileManager:shouldRemoveItemAtPath:';
162    function fileManager_shouldRemoveItemAtURL (fileManager: NSFileManager; URL: NSURL): ObjCBOOL; message 'fileManager:shouldRemoveItemAtURL:'; { available in 10_6, 4_0 }
163    function fileManager_shouldProceedAfterError_removingItemAtPath (fileManager: NSFileManager; error: NSError; path: NSString): ObjCBOOL; message 'fileManager:shouldProceedAfterError:removingItemAtPath:';
164    function fileManager_shouldProceedAfterError_removingItemAtURL (fileManager: NSFileManager; error: NSError; URL: NSURL): ObjCBOOL; message 'fileManager:shouldProceedAfterError:removingItemAtURL:'; { available in 10_6, 4_0 }
165  end;
166{$endif}
167
168{$ifdef CLASSES}
169
170type
171  NSDirectoryEnumerator = objcclass external (NSEnumerator)
172  public
173    function fileAttributes: NSDictionary; message 'fileAttributes';
174    function directoryAttributes: NSDictionary; message 'directoryAttributes';
175    procedure skipDescendents; message 'skipDescendents';
176    function level: NSUInteger; message 'level';
177    procedure skipDescendants; message 'skipDescendants'; { available in 10_6, 4_0 }
178  end;
179{$endif}
180
181{$ifdef EXTERNAL_SYMBOLS}
182var
183  NSFileType: NSString; cvar; external;
184  NSFileTypeDirectory: NSString; cvar; external;
185  NSFileTypeRegular: NSString; cvar; external;
186  NSFileTypeSymbolicLink: NSString; cvar; external;
187  NSFileTypeSocket: NSString; cvar; external;
188  NSFileTypeCharacterSpecial: NSString; cvar; external;
189  NSFileTypeBlockSpecial: NSString; cvar; external;
190  NSFileTypeUnknown: NSString; cvar; external;
191  NSFileSize: NSString; cvar; external;
192  NSFileModificationDate: NSString; cvar; external;
193  NSFileReferenceCount: NSString; cvar; external;
194  NSFileDeviceIdentifier: NSString; cvar; external;
195  NSFileOwnerAccountName: NSString; cvar; external;
196  NSFileGroupOwnerAccountName: NSString; cvar; external;
197  NSFilePosixPermissions: NSString; cvar; external;
198  NSFileSystemNumber: NSString; cvar; external;
199  NSFileSystemFileNumber: NSString; cvar; external;
200  NSFileExtensionHidden: NSString; cvar; external;
201  NSFileHFSCreatorCode: NSString; cvar; external;
202  NSFileHFSTypeCode: NSString; cvar; external;
203  NSFileImmutable: NSString; cvar; external;
204  NSFileAppendOnly: NSString; cvar; external;
205  NSFileCreationDate: NSString; cvar; external;
206  NSFileOwnerAccountID: NSString; cvar; external;
207  NSFileGroupOwnerAccountID: NSString; cvar; external;
208  NSFileBusy: NSString; cvar; external;
209  NSFileProtectionKey: NSString { available in 4_0 }; cvar; external;
210  NSFileProtectionNone: NSString { available in 4_0 }; cvar; external;
211  NSFileProtectionComplete: NSString { available in 4_0 }; cvar; external;
212  NSFileProtectionCompleteUnlessOpen: NSString { available in 5_0 }; cvar; external;
213  NSFileProtectionCompleteUntilFirstUserAuthentication: NSString { available in 5_0 }; cvar; external;
214  NSFileSystemSize: NSString; cvar; external;
215  NSFileSystemFreeSize: NSString; cvar; external;
216  NSFileSystemNodes: NSString; cvar; external;
217  NSFileSystemFreeNodes: NSString; cvar; external;
218{$endif}
219
220{$ifdef CLASSES}
221
222type
223  NSFileAttributes = objccategory external (NSDictionary)
224    function fileSize: culonglong; message 'fileSize';
225    function fileModificationDate: NSDate; message 'fileModificationDate';
226    function fileType: NSString; message 'fileType';
227    function filePosixPermissions: NSUInteger; message 'filePosixPermissions';
228    function fileOwnerAccountName: NSString; message 'fileOwnerAccountName';
229    function fileGroupOwnerAccountName: NSString; message 'fileGroupOwnerAccountName';
230    function fileSystemNumber: NSInteger; message 'fileSystemNumber';
231    function fileSystemFileNumber: NSUInteger; message 'fileSystemFileNumber';
232    function fileExtensionHidden: ObjCBOOL; message 'fileExtensionHidden';
233    function fileHFSCreatorCode: OSType; message 'fileHFSCreatorCode';
234    function fileHFSTypeCode: OSType; message 'fileHFSTypeCode';
235    function fileIsImmutable: ObjCBOOL; message 'fileIsImmutable';
236    function fileIsAppendOnly: ObjCBOOL; message 'fileIsAppendOnly';
237    function fileCreationDate: NSDate; message 'fileCreationDate';
238    function fileOwnerAccountID: NSNumber; message 'fileOwnerAccountID';
239    function fileGroupOwnerAccountID: NSNumber; message 'fileGroupOwnerAccountID';
240  end;
241{$endif}
242
243