objc2_foundation/generated/
NSFileManager.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfoundationversionwithfilemanagerresourceforksupport?language=objc)
10pub const NSFoundationVersionWithFileManagerResourceForkSupport: c_uint = 412;
11/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileattributekey?language=objc)
12// NS_TYPED_EXTENSIBLE_ENUM
13#[cfg(feature = "NSString")]
14pub type NSFileAttributeKey = NSString;
15
16/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileattributetype?language=objc)
17// NS_TYPED_ENUM
18#[cfg(feature = "NSString")]
19pub type NSFileAttributeType = NSString;
20
21/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileprotectiontype?language=objc)
22// NS_TYPED_ENUM
23#[cfg(feature = "NSString")]
24pub type NSFileProtectionType = NSString;
25
26/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileproviderservicename?language=objc)
27// NS_TYPED_EXTENSIBLE_ENUM
28#[cfg(feature = "NSString")]
29pub type NSFileProviderServiceName = NSString;
30
31/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsvolumeenumerationoptions?language=objc)
32// NS_OPTIONS
33#[repr(transparent)]
34#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35pub struct NSVolumeEnumerationOptions(pub NSUInteger);
36bitflags::bitflags! {
37    impl NSVolumeEnumerationOptions: NSUInteger {
38        #[doc(alias = "NSVolumeEnumerationSkipHiddenVolumes")]
39        const SkipHiddenVolumes = 1<<1;
40        #[doc(alias = "NSVolumeEnumerationProduceFileReferenceURLs")]
41        const ProduceFileReferenceURLs = 1<<2;
42    }
43}
44
45unsafe impl Encode for NSVolumeEnumerationOptions {
46    const ENCODING: Encoding = NSUInteger::ENCODING;
47}
48
49unsafe impl RefEncode for NSVolumeEnumerationOptions {
50    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
51}
52
53/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdirectoryenumerationoptions?language=objc)
54// NS_OPTIONS
55#[repr(transparent)]
56#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
57pub struct NSDirectoryEnumerationOptions(pub NSUInteger);
58bitflags::bitflags! {
59    impl NSDirectoryEnumerationOptions: NSUInteger {
60        #[doc(alias = "NSDirectoryEnumerationSkipsSubdirectoryDescendants")]
61        const SkipsSubdirectoryDescendants = 1<<0;
62        #[doc(alias = "NSDirectoryEnumerationSkipsPackageDescendants")]
63        const SkipsPackageDescendants = 1<<1;
64        #[doc(alias = "NSDirectoryEnumerationSkipsHiddenFiles")]
65        const SkipsHiddenFiles = 1<<2;
66        #[doc(alias = "NSDirectoryEnumerationIncludesDirectoriesPostOrder")]
67        const IncludesDirectoriesPostOrder = 1<<3;
68        #[doc(alias = "NSDirectoryEnumerationProducesRelativePathURLs")]
69        const ProducesRelativePathURLs = 1<<4;
70    }
71}
72
73unsafe impl Encode for NSDirectoryEnumerationOptions {
74    const ENCODING: Encoding = NSUInteger::ENCODING;
75}
76
77unsafe impl RefEncode for NSDirectoryEnumerationOptions {
78    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
79}
80
81/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilemanageritemreplacementoptions?language=objc)
82// NS_OPTIONS
83#[repr(transparent)]
84#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
85pub struct NSFileManagerItemReplacementOptions(pub NSUInteger);
86bitflags::bitflags! {
87    impl NSFileManagerItemReplacementOptions: NSUInteger {
88        #[doc(alias = "NSFileManagerItemReplacementUsingNewMetadataOnly")]
89        const UsingNewMetadataOnly = 1<<0;
90        #[doc(alias = "NSFileManagerItemReplacementWithoutDeletingBackupItem")]
91        const WithoutDeletingBackupItem = 1<<1;
92    }
93}
94
95unsafe impl Encode for NSFileManagerItemReplacementOptions {
96    const ENCODING: Encoding = NSUInteger::ENCODING;
97}
98
99unsafe impl RefEncode for NSFileManagerItemReplacementOptions {
100    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
101}
102
103/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsurlrelationship?language=objc)
104// NS_ENUM
105#[repr(transparent)]
106#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
107pub struct NSURLRelationship(pub NSInteger);
108impl NSURLRelationship {
109    #[doc(alias = "NSURLRelationshipContains")]
110    pub const Contains: Self = Self(0);
111    #[doc(alias = "NSURLRelationshipSame")]
112    pub const Same: Self = Self(1);
113    #[doc(alias = "NSURLRelationshipOther")]
114    pub const Other: Self = Self(2);
115}
116
117unsafe impl Encode for NSURLRelationship {
118    const ENCODING: Encoding = NSInteger::ENCODING;
119}
120
121unsafe impl RefEncode for NSURLRelationship {
122    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
123}
124
125/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilemanagerunmountoptions?language=objc)
126// NS_OPTIONS
127#[repr(transparent)]
128#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
129pub struct NSFileManagerUnmountOptions(pub NSUInteger);
130bitflags::bitflags! {
131    impl NSFileManagerUnmountOptions: NSUInteger {
132        #[doc(alias = "NSFileManagerUnmountAllPartitionsAndEjectDisk")]
133        const AllPartitionsAndEjectDisk = 1<<0;
134        #[doc(alias = "NSFileManagerUnmountWithoutUI")]
135        const WithoutUI = 1<<1;
136    }
137}
138
139unsafe impl Encode for NSFileManagerUnmountOptions {
140    const ENCODING: Encoding = NSUInteger::ENCODING;
141}
142
143unsafe impl RefEncode for NSFileManagerUnmountOptions {
144    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
145}
146
147extern "C" {
148    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilemanagerunmountdissentingprocessidentifiererrorkey?language=objc)
149    #[cfg(feature = "NSString")]
150    pub static NSFileManagerUnmountDissentingProcessIdentifierErrorKey: &'static NSString;
151}
152
153extern "C" {
154    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsubiquityidentitydidchangenotification?language=objc)
155    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
156    pub static NSUbiquityIdentityDidChangeNotification: &'static NSNotificationName;
157}
158
159/// An option set of the sync controls available for an item.
160///
161/// Get an instance of this type by calling ``URL/resourceValues(forKeys:)`` on a ``URL`` instance (Swift) or ``NSURL/getResourceValue:forKey:error:`` on an ``NSURL`` (Swift or Objective-C) and passing in the key ``NSURLUbiquitousItemSupportedSyncControlsKey``.
162///
163/// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilemanagersupportedsynccontrols?language=objc)
164// NS_OPTIONS
165#[repr(transparent)]
166#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
167pub struct NSFileManagerSupportedSyncControls(pub NSUInteger);
168bitflags::bitflags! {
169    impl NSFileManagerSupportedSyncControls: NSUInteger {
170/// The file provider supports pausing the sync on the item.
171        #[doc(alias = "NSFileManagerSupportedSyncControlsPauseSync")]
172        const PauseSync = 1<<0;
173/// The file provider supports failing an upload if the local and server versions conflict.
174        #[doc(alias = "NSFileManagerSupportedSyncControlsFailUploadOnConflict")]
175        const FailUploadOnConflict = 1<<1;
176    }
177}
178
179unsafe impl Encode for NSFileManagerSupportedSyncControls {
180    const ENCODING: Encoding = NSUInteger::ENCODING;
181}
182
183unsafe impl RefEncode for NSFileManagerSupportedSyncControls {
184    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
185}
186
187/// The behaviors the file manager can apply to resolve conflicts when resuming a sync.
188///
189/// You use this type when calling ``FileManager/resumeSyncForUbiquitousItem(at:with:completionHandler:)`` to resume synchronizing.
190/// In most situations, the ``NSFileManagerResumeSyncBehavior/preserveLocalChanges`` behavior is the best choice to avoid risk of data loss.
191///
192/// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilemanagerresumesyncbehavior?language=objc)
193// NS_ENUM
194#[repr(transparent)]
195#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
196pub struct NSFileManagerResumeSyncBehavior(pub NSInteger);
197impl NSFileManagerResumeSyncBehavior {
198    /// Resumes synchronizing by uploading the local version of the file.
199    ///
200    /// If the server has a newer version, the server may create a conflict copy of the file, or may automatically pick the winner of the conflict.
201    /// Apps can choose to implement conflict handling themselves by passing `NSFileManagerResumeSyncBehaviorAfterUploadWithFailOnConflict`.
202    #[doc(alias = "NSFileManagerResumeSyncBehaviorPreserveLocalChanges")]
203    pub const PreserveLocalChanges: Self = Self(0);
204    /// Resumes sync by first uploading the local version of the file, failing if the provider detects a conflict.
205    ///
206    /// If the upload succeeds, the sync resumes with the ``preserveLocalChanges`` behavior.
207    ///
208    /// If the provider detects a conflict, the upload fails with an  ``NSFileWriteUnknownError-enum.case``, with the underlying error of
209    /// <doc
210    /// ://com.apple.documentation/documentation/FileProvider/NSFileProviderError/localVersionConflictingWithServer>.
211    /// In this case, the app needs to call ``FileManager/fetchLatestRemoteVersionOfItem(at:completionHandler:)``, rebase local changes on top of the newly fetched version to resolve the conflict, and try again to resume sync.
212    /// This scenario is only available on paused items for which the file provider supports the fail-on-conflict behavior.
213    /// To check that the file provider supports the behavior, get the ``NSURLUbiquitousItemSupportedSyncControlsKey`` URL resource and verify that ``NSFileManagerSupportedSyncControls/failUploadOnConflict`` is `true`.
214    #[doc(alias = "NSFileManagerResumeSyncBehaviorAfterUploadWithFailOnConflict")]
215    pub const AfterUploadWithFailOnConflict: Self = Self(1);
216    /// Resumes synchronizing by overwriting any local changes with the remote version of the file.
217    ///
218    /// If a conflict occurs, the file manager stores the local changes as an alternate version.
219    /// Only use this behavior if you provide a separate means of resolving and merging conflicts.
220    #[doc(alias = "NSFileManagerResumeSyncBehaviorDropLocalChanges")]
221    pub const DropLocalChanges: Self = Self(2);
222}
223
224unsafe impl Encode for NSFileManagerResumeSyncBehavior {
225    const ENCODING: Encoding = NSInteger::ENCODING;
226}
227
228unsafe impl RefEncode for NSFileManagerResumeSyncBehavior {
229    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
230}
231
232/// The policies the file manager can apply to resolve conflicts when uploading a local version of a file.
233///
234/// See also [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilemanageruploadlocalversionconflictpolicy?language=objc)
235// NS_ENUM
236#[repr(transparent)]
237#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
238pub struct NSFileManagerUploadLocalVersionConflictPolicy(pub NSInteger);
239impl NSFileManagerUploadLocalVersionConflictPolicy {
240    /// Resolves the conflict using the policy defined by the file provider.
241    #[doc(alias = "NSFileManagerUploadConflictPolicyDefault")]
242    pub const ConflictPolicyDefault: Self = Self(0);
243    /// Resolves the conflict by causing the upload to fail.
244    ///
245    /// This policy causes an upload to fail if the local version of a file, with any local changes applied, doesn't match the server version.
246    /// In this scenario, call ``FileManager/fetchLatestRemoteVersionOfItem(at:completionHandler:)``, rebase local changes on top of the newly fetched version, and retry the upload.
247    ///
248    /// This policy is only available on paused items for which the file provider supports the fail-on-conflict behavior.
249    /// To check that the file provider supports the behavior, get the ``NSURLUbiquitousItemSupportedSyncControlsKey`` URL resource and verify that ``NSFileManagerSupportedSyncControls/failUploadOnConflict`` is `true`.
250    #[doc(alias = "NSFileManagerUploadConflictPolicyFailOnConflict")]
251    pub const ConflictPolicyFailOnConflict: Self = Self(1);
252}
253
254unsafe impl Encode for NSFileManagerUploadLocalVersionConflictPolicy {
255    const ENCODING: Encoding = NSInteger::ENCODING;
256}
257
258unsafe impl RefEncode for NSFileManagerUploadLocalVersionConflictPolicy {
259    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
260}
261
262extern_class!(
263    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilemanager?language=objc)
264    #[unsafe(super(NSObject))]
265    #[derive(Debug, PartialEq, Eq, Hash)]
266    pub struct NSFileManager;
267);
268
269extern_conformance!(
270    unsafe impl NSObjectProtocol for NSFileManager {}
271);
272
273impl NSFileManager {
274    extern_methods!(
275        #[unsafe(method(defaultManager))]
276        #[unsafe(method_family = none)]
277        pub fn defaultManager() -> Retained<NSFileManager>;
278
279        #[cfg(all(feature = "NSArray", feature = "NSString", feature = "NSURL"))]
280        #[unsafe(method(mountedVolumeURLsIncludingResourceValuesForKeys:options:))]
281        #[unsafe(method_family = none)]
282        pub fn mountedVolumeURLsIncludingResourceValuesForKeys_options(
283            &self,
284            property_keys: Option<&NSArray<NSURLResourceKey>>,
285            options: NSVolumeEnumerationOptions,
286        ) -> Option<Retained<NSArray<NSURL>>>;
287
288        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
289        /// # Safety
290        ///
291        /// `completion_handler` block must be sendable.
292        #[unsafe(method(unmountVolumeAtURL:options:completionHandler:))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn unmountVolumeAtURL_options_completionHandler(
295            &self,
296            url: &NSURL,
297            mask: NSFileManagerUnmountOptions,
298            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
299        );
300
301        #[cfg(all(
302            feature = "NSArray",
303            feature = "NSError",
304            feature = "NSString",
305            feature = "NSURL"
306        ))]
307        #[unsafe(method(contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error:_))]
308        #[unsafe(method_family = none)]
309        pub fn contentsOfDirectoryAtURL_includingPropertiesForKeys_options_error(
310            &self,
311            url: &NSURL,
312            keys: Option<&NSArray<NSURLResourceKey>>,
313            mask: NSDirectoryEnumerationOptions,
314        ) -> Result<Retained<NSArray<NSURL>>, Retained<NSError>>;
315
316        #[cfg(all(feature = "NSArray", feature = "NSPathUtilities", feature = "NSURL"))]
317        #[unsafe(method(URLsForDirectory:inDomains:))]
318        #[unsafe(method_family = none)]
319        pub fn URLsForDirectory_inDomains(
320            &self,
321            directory: NSSearchPathDirectory,
322            domain_mask: NSSearchPathDomainMask,
323        ) -> Retained<NSArray<NSURL>>;
324
325        #[cfg(all(feature = "NSError", feature = "NSPathUtilities", feature = "NSURL"))]
326        #[unsafe(method(URLForDirectory:inDomain:appropriateForURL:create:error:_))]
327        #[unsafe(method_family = none)]
328        pub fn URLForDirectory_inDomain_appropriateForURL_create_error(
329            &self,
330            directory: NSSearchPathDirectory,
331            domain: NSSearchPathDomainMask,
332            url: Option<&NSURL>,
333            should_create: bool,
334        ) -> Result<Retained<NSURL>, Retained<NSError>>;
335
336        #[cfg(all(feature = "NSError", feature = "NSURL"))]
337        /// # Safety
338        ///
339        /// `out_relationship` must be a valid pointer.
340        #[unsafe(method(getRelationship:ofDirectoryAtURL:toItemAtURL:error:_))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn getRelationship_ofDirectoryAtURL_toItemAtURL_error(
343            &self,
344            out_relationship: NonNull<NSURLRelationship>,
345            directory_url: &NSURL,
346            other_url: &NSURL,
347        ) -> Result<(), Retained<NSError>>;
348
349        #[cfg(all(feature = "NSError", feature = "NSPathUtilities", feature = "NSURL"))]
350        /// # Safety
351        ///
352        /// `out_relationship` must be a valid pointer.
353        #[unsafe(method(getRelationship:ofDirectory:inDomain:toItemAtURL:error:_))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn getRelationship_ofDirectory_inDomain_toItemAtURL_error(
356            &self,
357            out_relationship: NonNull<NSURLRelationship>,
358            directory: NSSearchPathDirectory,
359            domain_mask: NSSearchPathDomainMask,
360            url: &NSURL,
361        ) -> Result<(), Retained<NSError>>;
362
363        #[cfg(all(
364            feature = "NSDictionary",
365            feature = "NSError",
366            feature = "NSString",
367            feature = "NSURL"
368        ))]
369        /// # Safety
370        ///
371        /// `attributes` generic should be of the correct type.
372        #[unsafe(method(createDirectoryAtURL:withIntermediateDirectories:attributes:error:_))]
373        #[unsafe(method_family = none)]
374        pub unsafe fn createDirectoryAtURL_withIntermediateDirectories_attributes_error(
375            &self,
376            url: &NSURL,
377            create_intermediates: bool,
378            attributes: Option<&NSDictionary<NSFileAttributeKey, AnyObject>>,
379        ) -> Result<(), Retained<NSError>>;
380
381        #[cfg(all(feature = "NSError", feature = "NSURL"))]
382        #[unsafe(method(createSymbolicLinkAtURL:withDestinationURL:error:_))]
383        #[unsafe(method_family = none)]
384        pub fn createSymbolicLinkAtURL_withDestinationURL_error(
385            &self,
386            url: &NSURL,
387            dest_url: &NSURL,
388        ) -> Result<(), Retained<NSError>>;
389
390        /// # Safety
391        ///
392        /// This is not retained internally, you must ensure the object is still alive.
393        #[unsafe(method(delegate))]
394        #[unsafe(method_family = none)]
395        pub unsafe fn delegate(
396            &self,
397        ) -> Option<Retained<ProtocolObject<dyn NSFileManagerDelegate>>>;
398
399        /// Setter for [`delegate`][Self::delegate].
400        ///
401        /// # Safety
402        ///
403        /// This is unretained, you must ensure the object is kept alive while in use.
404        #[unsafe(method(setDelegate:))]
405        #[unsafe(method_family = none)]
406        pub unsafe fn setDelegate(
407            &self,
408            delegate: Option<&ProtocolObject<dyn NSFileManagerDelegate>>,
409        );
410
411        #[cfg(all(feature = "NSDictionary", feature = "NSError", feature = "NSString"))]
412        /// # Safety
413        ///
414        /// `attributes` generic should be of the correct type.
415        #[unsafe(method(setAttributes:ofItemAtPath:error:_))]
416        #[unsafe(method_family = none)]
417        pub unsafe fn setAttributes_ofItemAtPath_error(
418            &self,
419            attributes: &NSDictionary<NSFileAttributeKey, AnyObject>,
420            path: &NSString,
421        ) -> Result<(), Retained<NSError>>;
422
423        #[cfg(all(feature = "NSDictionary", feature = "NSError", feature = "NSString"))]
424        /// # Safety
425        ///
426        /// `attributes` generic should be of the correct type.
427        #[unsafe(method(createDirectoryAtPath:withIntermediateDirectories:attributes:error:_))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn createDirectoryAtPath_withIntermediateDirectories_attributes_error(
430            &self,
431            path: &NSString,
432            create_intermediates: bool,
433            attributes: Option<&NSDictionary<NSFileAttributeKey, AnyObject>>,
434        ) -> Result<(), Retained<NSError>>;
435
436        #[cfg(all(feature = "NSArray", feature = "NSError", feature = "NSString"))]
437        #[unsafe(method(contentsOfDirectoryAtPath:error:_))]
438        #[unsafe(method_family = none)]
439        pub fn contentsOfDirectoryAtPath_error(
440            &self,
441            path: &NSString,
442        ) -> Result<Retained<NSArray<NSString>>, Retained<NSError>>;
443
444        #[cfg(all(feature = "NSArray", feature = "NSError", feature = "NSString"))]
445        #[unsafe(method(subpathsOfDirectoryAtPath:error:_))]
446        #[unsafe(method_family = none)]
447        pub fn subpathsOfDirectoryAtPath_error(
448            &self,
449            path: &NSString,
450        ) -> Result<Retained<NSArray<NSString>>, Retained<NSError>>;
451
452        #[cfg(all(feature = "NSDictionary", feature = "NSError", feature = "NSString"))]
453        #[unsafe(method(attributesOfItemAtPath:error:_))]
454        #[unsafe(method_family = none)]
455        pub fn attributesOfItemAtPath_error(
456            &self,
457            path: &NSString,
458        ) -> Result<Retained<NSDictionary<NSFileAttributeKey, AnyObject>>, Retained<NSError>>;
459
460        #[cfg(all(feature = "NSDictionary", feature = "NSError", feature = "NSString"))]
461        #[unsafe(method(attributesOfFileSystemForPath:error:_))]
462        #[unsafe(method_family = none)]
463        pub fn attributesOfFileSystemForPath_error(
464            &self,
465            path: &NSString,
466        ) -> Result<Retained<NSDictionary<NSFileAttributeKey, AnyObject>>, Retained<NSError>>;
467
468        #[cfg(all(feature = "NSError", feature = "NSString"))]
469        #[unsafe(method(createSymbolicLinkAtPath:withDestinationPath:error:_))]
470        #[unsafe(method_family = none)]
471        pub fn createSymbolicLinkAtPath_withDestinationPath_error(
472            &self,
473            path: &NSString,
474            dest_path: &NSString,
475        ) -> Result<(), Retained<NSError>>;
476
477        #[cfg(all(feature = "NSError", feature = "NSString"))]
478        #[unsafe(method(destinationOfSymbolicLinkAtPath:error:_))]
479        #[unsafe(method_family = none)]
480        pub fn destinationOfSymbolicLinkAtPath_error(
481            &self,
482            path: &NSString,
483        ) -> Result<Retained<NSString>, Retained<NSError>>;
484
485        #[cfg(all(feature = "NSError", feature = "NSString"))]
486        #[unsafe(method(copyItemAtPath:toPath:error:_))]
487        #[unsafe(method_family = none)]
488        pub fn copyItemAtPath_toPath_error(
489            &self,
490            src_path: &NSString,
491            dst_path: &NSString,
492        ) -> Result<(), Retained<NSError>>;
493
494        #[cfg(all(feature = "NSError", feature = "NSString"))]
495        #[unsafe(method(moveItemAtPath:toPath:error:_))]
496        #[unsafe(method_family = none)]
497        pub fn moveItemAtPath_toPath_error(
498            &self,
499            src_path: &NSString,
500            dst_path: &NSString,
501        ) -> Result<(), Retained<NSError>>;
502
503        #[cfg(all(feature = "NSError", feature = "NSString"))]
504        #[unsafe(method(linkItemAtPath:toPath:error:_))]
505        #[unsafe(method_family = none)]
506        pub fn linkItemAtPath_toPath_error(
507            &self,
508            src_path: &NSString,
509            dst_path: &NSString,
510        ) -> Result<(), Retained<NSError>>;
511
512        #[cfg(all(feature = "NSError", feature = "NSString"))]
513        #[unsafe(method(removeItemAtPath:error:_))]
514        #[unsafe(method_family = none)]
515        pub fn removeItemAtPath_error(&self, path: &NSString) -> Result<(), Retained<NSError>>;
516
517        #[cfg(all(feature = "NSError", feature = "NSURL"))]
518        #[unsafe(method(copyItemAtURL:toURL:error:_))]
519        #[unsafe(method_family = none)]
520        pub fn copyItemAtURL_toURL_error(
521            &self,
522            src_url: &NSURL,
523            dst_url: &NSURL,
524        ) -> Result<(), Retained<NSError>>;
525
526        #[cfg(all(feature = "NSError", feature = "NSURL"))]
527        #[unsafe(method(moveItemAtURL:toURL:error:_))]
528        #[unsafe(method_family = none)]
529        pub fn moveItemAtURL_toURL_error(
530            &self,
531            src_url: &NSURL,
532            dst_url: &NSURL,
533        ) -> Result<(), Retained<NSError>>;
534
535        #[cfg(all(feature = "NSError", feature = "NSURL"))]
536        #[unsafe(method(linkItemAtURL:toURL:error:_))]
537        #[unsafe(method_family = none)]
538        pub fn linkItemAtURL_toURL_error(
539            &self,
540            src_url: &NSURL,
541            dst_url: &NSURL,
542        ) -> Result<(), Retained<NSError>>;
543
544        #[cfg(all(feature = "NSError", feature = "NSURL"))]
545        #[unsafe(method(removeItemAtURL:error:_))]
546        #[unsafe(method_family = none)]
547        pub fn removeItemAtURL_error(&self, url: &NSURL) -> Result<(), Retained<NSError>>;
548
549        #[cfg(all(feature = "NSError", feature = "NSURL"))]
550        #[unsafe(method(trashItemAtURL:resultingItemURL:error:_))]
551        #[unsafe(method_family = none)]
552        pub fn trashItemAtURL_resultingItemURL_error(
553            &self,
554            url: &NSURL,
555            out_resulting_url: Option<&mut Option<Retained<NSURL>>>,
556        ) -> Result<(), Retained<NSError>>;
557
558        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
559        #[deprecated = "Use -attributesOfItemAtPath:error: instead"]
560        #[unsafe(method(fileAttributesAtPath:traverseLink:))]
561        #[unsafe(method_family = none)]
562        pub fn fileAttributesAtPath_traverseLink(
563            &self,
564            path: &NSString,
565            yorn: bool,
566        ) -> Option<Retained<NSDictionary>>;
567
568        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
569        /// # Safety
570        ///
571        /// `attributes` generic should be of the correct type.
572        #[deprecated = "Use -setAttributes:ofItemAtPath:error: instead"]
573        #[unsafe(method(changeFileAttributes:atPath:))]
574        #[unsafe(method_family = none)]
575        pub unsafe fn changeFileAttributes_atPath(
576            &self,
577            attributes: &NSDictionary,
578            path: &NSString,
579        ) -> bool;
580
581        #[cfg(all(feature = "NSArray", feature = "NSString"))]
582        #[deprecated = "Use -contentsOfDirectoryAtPath:error: instead"]
583        #[unsafe(method(directoryContentsAtPath:))]
584        #[unsafe(method_family = none)]
585        pub fn directoryContentsAtPath(&self, path: &NSString) -> Option<Retained<NSArray>>;
586
587        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
588        #[deprecated = "Use -attributesOfFileSystemForPath:error: instead"]
589        #[unsafe(method(fileSystemAttributesAtPath:))]
590        #[unsafe(method_family = none)]
591        pub fn fileSystemAttributesAtPath(&self, path: &NSString)
592            -> Option<Retained<NSDictionary>>;
593
594        #[cfg(feature = "NSString")]
595        #[deprecated = "Use -destinationOfSymbolicLinkAtPath:error:"]
596        #[unsafe(method(pathContentOfSymbolicLinkAtPath:))]
597        #[unsafe(method_family = none)]
598        pub fn pathContentOfSymbolicLinkAtPath(
599            &self,
600            path: &NSString,
601        ) -> Option<Retained<NSString>>;
602
603        #[cfg(feature = "NSString")]
604        #[deprecated = "Use -createSymbolicLinkAtPath:error: instead"]
605        #[unsafe(method(createSymbolicLinkAtPath:pathContent:))]
606        #[unsafe(method_family = none)]
607        pub fn createSymbolicLinkAtPath_pathContent(
608            &self,
609            path: &NSString,
610            otherpath: &NSString,
611        ) -> bool;
612
613        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
614        /// # Safety
615        ///
616        /// `attributes` generic should be of the correct type.
617        #[deprecated = "Use -createDirectoryAtPath:withIntermediateDirectories:attributes:error: instead"]
618        #[unsafe(method(createDirectoryAtPath:attributes:))]
619        #[unsafe(method_family = none)]
620        pub unsafe fn createDirectoryAtPath_attributes(
621            &self,
622            path: &NSString,
623            attributes: &NSDictionary,
624        ) -> bool;
625
626        #[cfg(feature = "NSString")]
627        /// # Safety
628        ///
629        /// `handler` should be of the correct type.
630        #[deprecated = "Not supported"]
631        #[unsafe(method(linkPath:toPath:handler:))]
632        #[unsafe(method_family = none)]
633        pub unsafe fn linkPath_toPath_handler(
634            &self,
635            src: &NSString,
636            dest: &NSString,
637            handler: Option<&AnyObject>,
638        ) -> bool;
639
640        #[cfg(feature = "NSString")]
641        /// # Safety
642        ///
643        /// `handler` should be of the correct type.
644        #[deprecated = "Not supported"]
645        #[unsafe(method(copyPath:toPath:handler:))]
646        #[unsafe(method_family = none)]
647        pub unsafe fn copyPath_toPath_handler(
648            &self,
649            src: &NSString,
650            dest: &NSString,
651            handler: Option<&AnyObject>,
652        ) -> bool;
653
654        #[cfg(feature = "NSString")]
655        /// # Safety
656        ///
657        /// `handler` should be of the correct type.
658        #[deprecated = "Not supported"]
659        #[unsafe(method(movePath:toPath:handler:))]
660        #[unsafe(method_family = none)]
661        pub unsafe fn movePath_toPath_handler(
662            &self,
663            src: &NSString,
664            dest: &NSString,
665            handler: Option<&AnyObject>,
666        ) -> bool;
667
668        #[cfg(feature = "NSString")]
669        /// # Safety
670        ///
671        /// `handler` should be of the correct type.
672        #[deprecated = "Not supported"]
673        #[unsafe(method(removeFileAtPath:handler:))]
674        #[unsafe(method_family = none)]
675        pub unsafe fn removeFileAtPath_handler(
676            &self,
677            path: &NSString,
678            handler: Option<&AnyObject>,
679        ) -> bool;
680
681        #[cfg(feature = "NSString")]
682        #[unsafe(method(currentDirectoryPath))]
683        #[unsafe(method_family = none)]
684        pub fn currentDirectoryPath(&self) -> Retained<NSString>;
685
686        #[cfg(feature = "NSString")]
687        #[unsafe(method(changeCurrentDirectoryPath:))]
688        #[unsafe(method_family = none)]
689        pub fn changeCurrentDirectoryPath(&self, path: &NSString) -> bool;
690
691        #[cfg(feature = "NSString")]
692        #[unsafe(method(fileExistsAtPath:))]
693        #[unsafe(method_family = none)]
694        pub fn fileExistsAtPath(&self, path: &NSString) -> bool;
695
696        #[cfg(feature = "NSString")]
697        /// # Safety
698        ///
699        /// `is_directory` must be a valid pointer or null.
700        #[unsafe(method(fileExistsAtPath:isDirectory:))]
701        #[unsafe(method_family = none)]
702        pub unsafe fn fileExistsAtPath_isDirectory(
703            &self,
704            path: &NSString,
705            is_directory: *mut Bool,
706        ) -> bool;
707
708        #[cfg(feature = "NSString")]
709        #[unsafe(method(isReadableFileAtPath:))]
710        #[unsafe(method_family = none)]
711        pub fn isReadableFileAtPath(&self, path: &NSString) -> bool;
712
713        #[cfg(feature = "NSString")]
714        #[unsafe(method(isWritableFileAtPath:))]
715        #[unsafe(method_family = none)]
716        pub fn isWritableFileAtPath(&self, path: &NSString) -> bool;
717
718        #[cfg(feature = "NSString")]
719        #[unsafe(method(isExecutableFileAtPath:))]
720        #[unsafe(method_family = none)]
721        pub fn isExecutableFileAtPath(&self, path: &NSString) -> bool;
722
723        #[cfg(feature = "NSString")]
724        #[unsafe(method(isDeletableFileAtPath:))]
725        #[unsafe(method_family = none)]
726        pub fn isDeletableFileAtPath(&self, path: &NSString) -> bool;
727
728        #[cfg(feature = "NSString")]
729        #[unsafe(method(contentsEqualAtPath:andPath:))]
730        #[unsafe(method_family = none)]
731        pub fn contentsEqualAtPath_andPath(&self, path1: &NSString, path2: &NSString) -> bool;
732
733        #[cfg(feature = "NSString")]
734        #[unsafe(method(displayNameAtPath:))]
735        #[unsafe(method_family = none)]
736        pub fn displayNameAtPath(&self, path: &NSString) -> Retained<NSString>;
737
738        #[cfg(all(feature = "NSArray", feature = "NSString"))]
739        #[unsafe(method(componentsToDisplayForPath:))]
740        #[unsafe(method_family = none)]
741        pub fn componentsToDisplayForPath(
742            &self,
743            path: &NSString,
744        ) -> Option<Retained<NSArray<NSString>>>;
745
746        #[cfg(all(feature = "NSEnumerator", feature = "NSString"))]
747        #[unsafe(method(enumeratorAtPath:))]
748        #[unsafe(method_family = none)]
749        pub fn enumeratorAtPath(
750            &self,
751            path: &NSString,
752        ) -> Option<Retained<NSDirectoryEnumerator<NSString>>>;
753
754        #[cfg(all(
755            feature = "NSArray",
756            feature = "NSEnumerator",
757            feature = "NSError",
758            feature = "NSString",
759            feature = "NSURL",
760            feature = "block2"
761        ))]
762        #[unsafe(method(enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:))]
763        #[unsafe(method_family = none)]
764        pub fn enumeratorAtURL_includingPropertiesForKeys_options_errorHandler(
765            &self,
766            url: &NSURL,
767            keys: Option<&NSArray<NSURLResourceKey>>,
768            mask: NSDirectoryEnumerationOptions,
769            handler: Option<&block2::DynBlock<dyn Fn(NonNull<NSURL>, NonNull<NSError>) -> Bool>>,
770        ) -> Option<Retained<NSDirectoryEnumerator<NSURL>>>;
771
772        #[cfg(all(feature = "NSArray", feature = "NSString"))]
773        #[unsafe(method(subpathsAtPath:))]
774        #[unsafe(method_family = none)]
775        pub fn subpathsAtPath(&self, path: &NSString) -> Option<Retained<NSArray<NSString>>>;
776
777        #[cfg(all(feature = "NSData", feature = "NSString"))]
778        #[unsafe(method(contentsAtPath:))]
779        #[unsafe(method_family = none)]
780        pub fn contentsAtPath(&self, path: &NSString) -> Option<Retained<NSData>>;
781
782        #[cfg(all(feature = "NSData", feature = "NSDictionary", feature = "NSString"))]
783        /// # Safety
784        ///
785        /// `attr` generic should be of the correct type.
786        #[unsafe(method(createFileAtPath:contents:attributes:))]
787        #[unsafe(method_family = none)]
788        pub unsafe fn createFileAtPath_contents_attributes(
789            &self,
790            path: &NSString,
791            data: Option<&NSData>,
792            attr: Option<&NSDictionary<NSFileAttributeKey, AnyObject>>,
793        ) -> bool;
794
795        #[cfg(feature = "NSString")]
796        #[unsafe(method(fileSystemRepresentationWithPath:))]
797        #[unsafe(method_family = none)]
798        pub fn fileSystemRepresentationWithPath(&self, path: &NSString) -> NonNull<c_char>;
799
800        #[cfg(feature = "NSString")]
801        /// # Safety
802        ///
803        /// `str` must be a valid pointer.
804        #[unsafe(method(stringWithFileSystemRepresentation:length:))]
805        #[unsafe(method_family = none)]
806        pub unsafe fn stringWithFileSystemRepresentation_length(
807            &self,
808            str: NonNull<c_char>,
809            len: NSUInteger,
810        ) -> Retained<NSString>;
811
812        #[cfg(all(feature = "NSError", feature = "NSString", feature = "NSURL"))]
813        #[unsafe(method(replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error:_))]
814        #[unsafe(method_family = none)]
815        pub fn replaceItemAtURL_withItemAtURL_backupItemName_options_resultingItemURL_error(
816            &self,
817            original_item_url: &NSURL,
818            new_item_url: &NSURL,
819            backup_item_name: Option<&NSString>,
820            options: NSFileManagerItemReplacementOptions,
821            resulting_url: Option<&mut Option<Retained<NSURL>>>,
822        ) -> Result<(), Retained<NSError>>;
823
824        #[cfg(all(feature = "NSError", feature = "NSURL"))]
825        #[unsafe(method(setUbiquitous:itemAtURL:destinationURL:error:_))]
826        #[unsafe(method_family = none)]
827        pub fn setUbiquitous_itemAtURL_destinationURL_error(
828            &self,
829            flag: bool,
830            url: &NSURL,
831            destination_url: &NSURL,
832        ) -> Result<(), Retained<NSError>>;
833
834        #[cfg(feature = "NSURL")]
835        #[unsafe(method(isUbiquitousItemAtURL:))]
836        #[unsafe(method_family = none)]
837        pub fn isUbiquitousItemAtURL(&self, url: &NSURL) -> bool;
838
839        #[cfg(all(feature = "NSError", feature = "NSURL"))]
840        #[unsafe(method(startDownloadingUbiquitousItemAtURL:error:_))]
841        #[unsafe(method_family = none)]
842        pub fn startDownloadingUbiquitousItemAtURL_error(
843            &self,
844            url: &NSURL,
845        ) -> Result<(), Retained<NSError>>;
846
847        #[cfg(all(feature = "NSError", feature = "NSURL"))]
848        #[unsafe(method(evictUbiquitousItemAtURL:error:_))]
849        #[unsafe(method_family = none)]
850        pub fn evictUbiquitousItemAtURL_error(&self, url: &NSURL) -> Result<(), Retained<NSError>>;
851
852        #[cfg(all(feature = "NSString", feature = "NSURL"))]
853        #[unsafe(method(URLForUbiquityContainerIdentifier:))]
854        #[unsafe(method_family = none)]
855        pub fn URLForUbiquityContainerIdentifier(
856            &self,
857            container_identifier: Option<&NSString>,
858        ) -> Option<Retained<NSURL>>;
859
860        #[cfg(all(feature = "NSDate", feature = "NSError", feature = "NSURL"))]
861        #[unsafe(method(URLForPublishingUbiquitousItemAtURL:expirationDate:error:_))]
862        #[unsafe(method_family = none)]
863        pub fn URLForPublishingUbiquitousItemAtURL_expirationDate_error(
864            &self,
865            url: &NSURL,
866            out_date: Option<&mut Option<Retained<NSDate>>>,
867        ) -> Result<Retained<NSURL>, Retained<NSError>>;
868
869        #[cfg(feature = "NSObject")]
870        #[unsafe(method(ubiquityIdentityToken))]
871        #[unsafe(method_family = none)]
872        pub fn ubiquityIdentityToken(
873            &self,
874        ) -> Option<Retained<AnyObject /* NSObjectProtocol+ NSCopying+ NSCoding */>>;
875
876        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
877        /// Asynchronously pauses sync of an item at the given URL.
878        ///
879        /// Call this when opening an item to prevent sync from altering the contents of the URL.
880        /// Once paused, the file provider will not upload local changes nor download remote changes.
881        ///
882        /// While paused, call ``uploadLocalVersionOfUbiquitousItem(at:withConflictResolutionPolicy:completionHandler:)`` when the document is in a stable state.
883        /// This action keeps the server version as up-to-date as possible.
884        ///
885        /// If the item is already paused, a second call to this method reports success.
886        /// If the file provider is already applying changes to the item, the pause fails with an ``NSFileWriteUnknownError-enum.case``, with an underlying error that has domain ``NSPOSIXErrorDomain`` and code ``POSIXError/EBUSY``.
887        /// If the pause fails, wait for the state to stabilize before retrying.
888        /// Pausing also fails with ``CocoaError/featureUnsupported`` if `url` refers to a regular (non-package) directory.
889        ///
890        /// Pausing sync is independent of the calling app's lifecycle; sync doesn't automatically resume if the app closes or crashes and relaunches later.
891        /// To resume syncing, explicitly call ``resumeSyncForUbiquitousItem(at:with:completionHandler:)``.
892        /// Always be sure to resume syncing before you close the item.
893        ///
894        /// - Parameters:
895        /// - url: The URL of the item for which to pause sync.
896        /// - completionHandler: A closure or block that the framework calls when the pause action completes. It receives a single ``NSError`` parameter to indicate an error that prevented pausing; this value is `nil` if the pause succeeded. In Swift, you can omit the completion handler and catch the thrown error instead.
897        ///
898        /// # Safety
899        ///
900        /// `completion_handler` block must be sendable.
901        #[unsafe(method(pauseSyncForUbiquitousItemAtURL:completionHandler:))]
902        #[unsafe(method_family = none)]
903        pub unsafe fn pauseSyncForUbiquitousItemAtURL_completionHandler(
904            &self,
905            url: &NSURL,
906            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
907        );
908
909        #[cfg(all(feature = "NSError", feature = "NSURL", feature = "block2"))]
910        /// Asynchronously resumes the sync on a paused item using the given resume behavior.
911        ///
912        /// Always call this method when your app closes an item to allow the file provider to sync local changes back to the server.
913        ///
914        /// In most situations, the ``NSFileManagerResumeSyncBehavior/preserveLocalChanges`` behavior is the best choice to avoid any risk of data loss.
915        ///
916        /// The resume call fails with ``CocoaError/featureUnsupported`` if `url` isn't currently paused.
917        /// If the device isn't connected to the network, the call may fail with ``NSFileWriteUnknownError-enum.case``, with the underlying error of
918        /// <doc
919        /// ://com.apple.documentation/documentation/FileProvider/NSFileProviderError/serverUnreachable>.
920        ///
921        /// - Parameters:
922        /// - url: The URL of the item for which to resume sync.
923        /// - behavior: A ``NSFileManagerResumeSyncBehavior`` value that tells the file manager how to handle conflicts between local and remote versions of files.
924        /// - completionHandler: A closure or block that the framework calls when the resume action completes. It receives a single ``NSError`` parameter to indicate an error that prevented the resume action; the value is `nil` if the resume succeeded. In Swift, you can omit the completion handler and catch the thrown error instead.
925        ///
926        /// # Safety
927        ///
928        /// `completion_handler` block must be sendable.
929        #[unsafe(method(resumeSyncForUbiquitousItemAtURL:withBehavior:completionHandler:))]
930        #[unsafe(method_family = none)]
931        pub unsafe fn resumeSyncForUbiquitousItemAtURL_withBehavior_completionHandler(
932            &self,
933            url: &NSURL,
934            behavior: NSFileManagerResumeSyncBehavior,
935            completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
936        );
937
938        #[cfg(all(
939            feature = "NSError",
940            feature = "NSFileVersion",
941            feature = "NSURL",
942            feature = "block2"
943        ))]
944        /// Asynchronously fetches the latest remote version of a given item from the server.
945        ///
946        /// Use this method if uploading fails due to a version conflict and sync is paused.
947        /// In this case, fetching the latest remote version allows you to inspect the newer item from the server, resolve the conflict, and resume uploading.
948        ///
949        /// The version provided by this call depends on several factors:
950        /// * If there is no newer version of the file on the server, the caller receives the current version of the file.
951        /// * If the server has a newer version and sync isn't paused, this call replaces the local item and provides the version of the new item.
952        /// * If the server has a newer version but sync is paused, the returned version points to a side location. In this case, call ``NSFileVersion/replaceItem(at:options:)`` on the provided version object to replace the local item with the newer item from the server.
953        ///
954        /// If the device isn't connected to the network, the call may fail with ``NSFileReadUnknownError-enum.case``, with the underlying error of
955        /// <doc
956        /// ://com.apple.documentation/documentation/FileProvider/NSFileProviderError/serverUnreachable>.
957        ///
958        /// - Parameters:
959        /// - url: The URL of the item for which to check the version.
960        /// - completionHandler: A closure or block that the framework calls when the fetch action completes. It receives parameters of types ``NSFileVersion`` and ``NSError``. The error is `nil` if fetching the remote version succeeded; otherwise it indicates the error that caused the call to fail. In Swift, you can omit the completion handler, catching any error in a `do`-`catch` block and receiving the version as the return value.
961        ///
962        /// # Safety
963        ///
964        /// `completion_handler` block must be sendable.
965        #[unsafe(method(fetchLatestRemoteVersionOfItemAtURL:completionHandler:))]
966        #[unsafe(method_family = none)]
967        pub unsafe fn fetchLatestRemoteVersionOfItemAtURL_completionHandler(
968            &self,
969            url: &NSURL,
970            completion_handler: &block2::DynBlock<dyn Fn(*mut NSFileVersion, *mut NSError)>,
971        );
972
973        #[cfg(all(
974            feature = "NSError",
975            feature = "NSFileVersion",
976            feature = "NSURL",
977            feature = "block2"
978        ))]
979        /// Asynchronously uploads the local version of the item using the provided conflict resolution policy.
980        ///
981        /// Once your app pauses a sync for an item, call this method every time your document is in a stable state.
982        /// This action keeps the server version as up-to-date as possible.
983        ///
984        /// If the server has a newer version than the one to which the app made changes, uploading fails with ``NSFileWriteUnknownError-enum.case``, with an underlying error of
985        /// <doc
986        /// ://com.apple.documentation/documentation/FileProvider/NSFileProviderError/localVersionConflictingWithServer>.
987        /// In this case, call ``FileManager/fetchLatestRemoteVersionOfItem(at:completionHandler:)``, rebase local changes on top of that version, and retry the upload.
988        ///
989        /// If the device isn't connected to the network, the call may fail with ``NSFileWriteUnknownError-enum.case``, with the underlying error of
990        /// <doc
991        /// ://com.apple.documentation/documentation/FileProvider/NSFileProviderError/serverUnreachable>.
992        ///
993        /// - Parameters:
994        /// - url: The URL of the item for which to check the version.
995        /// - conflictResolutionPolicy: The policy the file manager applies if the local and server versions conflict.
996        /// - completionHandler: A closure or block that the framework calls when the upload completes. It receives parameters of types ``NSFileVersion`` and ``NSError``. The error is `nil` if fetching the remote version succeeded; otherwise it indicates the error that caused the call to fail. In Swift, you can omit the completion handler, catching any error in a `do`-`catch` block and receiving the version as the return value.
997        ///
998        /// # Safety
999        ///
1000        /// `completion_handler` block must be sendable.
1001        #[unsafe(method(uploadLocalVersionOfUbiquitousItemAtURL:withConflictResolutionPolicy:completionHandler:))]
1002        #[unsafe(method_family = none)]
1003        pub unsafe fn uploadLocalVersionOfUbiquitousItemAtURL_withConflictResolutionPolicy_completionHandler(
1004            &self,
1005            url: &NSURL,
1006            conflict_resolution_policy: NSFileManagerUploadLocalVersionConflictPolicy,
1007            completion_handler: &block2::DynBlock<dyn Fn(*mut NSFileVersion, *mut NSError)>,
1008        );
1009
1010        #[cfg(all(
1011            feature = "NSDictionary",
1012            feature = "NSError",
1013            feature = "NSString",
1014            feature = "NSURL",
1015            feature = "block2"
1016        ))]
1017        /// # Safety
1018        ///
1019        /// `completion_handler` block must be sendable.
1020        #[unsafe(method(getFileProviderServicesForItemAtURL:completionHandler:))]
1021        #[unsafe(method_family = none)]
1022        pub unsafe fn getFileProviderServicesForItemAtURL_completionHandler(
1023            &self,
1024            url: &NSURL,
1025            completion_handler: &block2::DynBlock<
1026                dyn Fn(
1027                    *mut NSDictionary<NSFileProviderServiceName, NSFileProviderService>,
1028                    *mut NSError,
1029                ),
1030            >,
1031        );
1032
1033        #[cfg(all(feature = "NSString", feature = "NSURL"))]
1034        #[unsafe(method(containerURLForSecurityApplicationGroupIdentifier:))]
1035        #[unsafe(method_family = none)]
1036        pub fn containerURLForSecurityApplicationGroupIdentifier(
1037            &self,
1038            group_identifier: &NSString,
1039        ) -> Option<Retained<NSURL>>;
1040    );
1041}
1042
1043/// Methods declared on superclass `NSObject`.
1044impl NSFileManager {
1045    extern_methods!(
1046        #[unsafe(method(init))]
1047        #[unsafe(method_family = init)]
1048        pub fn init(this: Allocated<Self>) -> Retained<Self>;
1049
1050        #[unsafe(method(new))]
1051        #[unsafe(method_family = new)]
1052        pub fn new() -> Retained<Self>;
1053    );
1054}
1055
1056impl DefaultRetained for NSFileManager {
1057    #[inline]
1058    fn default_retained() -> Retained<Self> {
1059        Self::new()
1060    }
1061}
1062
1063/// NSUserInformation.
1064impl NSFileManager {
1065    extern_methods!(
1066        #[cfg(feature = "NSURL")]
1067        #[unsafe(method(homeDirectoryForCurrentUser))]
1068        #[unsafe(method_family = none)]
1069        pub fn homeDirectoryForCurrentUser(&self) -> Retained<NSURL>;
1070
1071        #[cfg(feature = "NSURL")]
1072        #[unsafe(method(temporaryDirectory))]
1073        #[unsafe(method_family = none)]
1074        pub fn temporaryDirectory(&self) -> Retained<NSURL>;
1075
1076        #[cfg(all(feature = "NSString", feature = "NSURL"))]
1077        #[unsafe(method(homeDirectoryForUser:))]
1078        #[unsafe(method_family = none)]
1079        pub fn homeDirectoryForUser(&self, user_name: &NSString) -> Option<Retained<NSURL>>;
1080    );
1081}
1082
1083extern_protocol!(
1084    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilemanagerdelegate?language=objc)
1085    pub unsafe trait NSFileManagerDelegate: NSObjectProtocol {
1086        #[cfg(feature = "NSString")]
1087        #[optional]
1088        #[unsafe(method(fileManager:shouldCopyItemAtPath:toPath:))]
1089        #[unsafe(method_family = none)]
1090        fn fileManager_shouldCopyItemAtPath_toPath(
1091            &self,
1092            file_manager: &NSFileManager,
1093            src_path: &NSString,
1094            dst_path: &NSString,
1095        ) -> bool;
1096
1097        #[cfg(feature = "NSURL")]
1098        #[optional]
1099        #[unsafe(method(fileManager:shouldCopyItemAtURL:toURL:))]
1100        #[unsafe(method_family = none)]
1101        fn fileManager_shouldCopyItemAtURL_toURL(
1102            &self,
1103            file_manager: &NSFileManager,
1104            src_url: &NSURL,
1105            dst_url: &NSURL,
1106        ) -> bool;
1107
1108        #[cfg(all(feature = "NSError", feature = "NSString"))]
1109        #[optional]
1110        #[unsafe(method(fileManager:shouldProceedAfterError:copyingItemAtPath:toPath:))]
1111        #[unsafe(method_family = none)]
1112        fn fileManager_shouldProceedAfterError_copyingItemAtPath_toPath(
1113            &self,
1114            file_manager: &NSFileManager,
1115            error: &NSError,
1116            src_path: &NSString,
1117            dst_path: &NSString,
1118        ) -> bool;
1119
1120        #[cfg(all(feature = "NSError", feature = "NSURL"))]
1121        #[optional]
1122        #[unsafe(method(fileManager:shouldProceedAfterError:copyingItemAtURL:toURL:))]
1123        #[unsafe(method_family = none)]
1124        fn fileManager_shouldProceedAfterError_copyingItemAtURL_toURL(
1125            &self,
1126            file_manager: &NSFileManager,
1127            error: &NSError,
1128            src_url: &NSURL,
1129            dst_url: &NSURL,
1130        ) -> bool;
1131
1132        #[cfg(feature = "NSString")]
1133        #[optional]
1134        #[unsafe(method(fileManager:shouldMoveItemAtPath:toPath:))]
1135        #[unsafe(method_family = none)]
1136        fn fileManager_shouldMoveItemAtPath_toPath(
1137            &self,
1138            file_manager: &NSFileManager,
1139            src_path: &NSString,
1140            dst_path: &NSString,
1141        ) -> bool;
1142
1143        #[cfg(feature = "NSURL")]
1144        #[optional]
1145        #[unsafe(method(fileManager:shouldMoveItemAtURL:toURL:))]
1146        #[unsafe(method_family = none)]
1147        fn fileManager_shouldMoveItemAtURL_toURL(
1148            &self,
1149            file_manager: &NSFileManager,
1150            src_url: &NSURL,
1151            dst_url: &NSURL,
1152        ) -> bool;
1153
1154        #[cfg(all(feature = "NSError", feature = "NSString"))]
1155        #[optional]
1156        #[unsafe(method(fileManager:shouldProceedAfterError:movingItemAtPath:toPath:))]
1157        #[unsafe(method_family = none)]
1158        fn fileManager_shouldProceedAfterError_movingItemAtPath_toPath(
1159            &self,
1160            file_manager: &NSFileManager,
1161            error: &NSError,
1162            src_path: &NSString,
1163            dst_path: &NSString,
1164        ) -> bool;
1165
1166        #[cfg(all(feature = "NSError", feature = "NSURL"))]
1167        #[optional]
1168        #[unsafe(method(fileManager:shouldProceedAfterError:movingItemAtURL:toURL:))]
1169        #[unsafe(method_family = none)]
1170        fn fileManager_shouldProceedAfterError_movingItemAtURL_toURL(
1171            &self,
1172            file_manager: &NSFileManager,
1173            error: &NSError,
1174            src_url: &NSURL,
1175            dst_url: &NSURL,
1176        ) -> bool;
1177
1178        #[cfg(feature = "NSString")]
1179        #[optional]
1180        #[unsafe(method(fileManager:shouldLinkItemAtPath:toPath:))]
1181        #[unsafe(method_family = none)]
1182        fn fileManager_shouldLinkItemAtPath_toPath(
1183            &self,
1184            file_manager: &NSFileManager,
1185            src_path: &NSString,
1186            dst_path: &NSString,
1187        ) -> bool;
1188
1189        #[cfg(feature = "NSURL")]
1190        #[optional]
1191        #[unsafe(method(fileManager:shouldLinkItemAtURL:toURL:))]
1192        #[unsafe(method_family = none)]
1193        fn fileManager_shouldLinkItemAtURL_toURL(
1194            &self,
1195            file_manager: &NSFileManager,
1196            src_url: &NSURL,
1197            dst_url: &NSURL,
1198        ) -> bool;
1199
1200        #[cfg(all(feature = "NSError", feature = "NSString"))]
1201        #[optional]
1202        #[unsafe(method(fileManager:shouldProceedAfterError:linkingItemAtPath:toPath:))]
1203        #[unsafe(method_family = none)]
1204        fn fileManager_shouldProceedAfterError_linkingItemAtPath_toPath(
1205            &self,
1206            file_manager: &NSFileManager,
1207            error: &NSError,
1208            src_path: &NSString,
1209            dst_path: &NSString,
1210        ) -> bool;
1211
1212        #[cfg(all(feature = "NSError", feature = "NSURL"))]
1213        #[optional]
1214        #[unsafe(method(fileManager:shouldProceedAfterError:linkingItemAtURL:toURL:))]
1215        #[unsafe(method_family = none)]
1216        fn fileManager_shouldProceedAfterError_linkingItemAtURL_toURL(
1217            &self,
1218            file_manager: &NSFileManager,
1219            error: &NSError,
1220            src_url: &NSURL,
1221            dst_url: &NSURL,
1222        ) -> bool;
1223
1224        #[cfg(feature = "NSString")]
1225        #[optional]
1226        #[unsafe(method(fileManager:shouldRemoveItemAtPath:))]
1227        #[unsafe(method_family = none)]
1228        fn fileManager_shouldRemoveItemAtPath(
1229            &self,
1230            file_manager: &NSFileManager,
1231            path: &NSString,
1232        ) -> bool;
1233
1234        #[cfg(feature = "NSURL")]
1235        #[optional]
1236        #[unsafe(method(fileManager:shouldRemoveItemAtURL:))]
1237        #[unsafe(method_family = none)]
1238        fn fileManager_shouldRemoveItemAtURL(
1239            &self,
1240            file_manager: &NSFileManager,
1241            url: &NSURL,
1242        ) -> bool;
1243
1244        #[cfg(all(feature = "NSError", feature = "NSString"))]
1245        #[optional]
1246        #[unsafe(method(fileManager:shouldProceedAfterError:removingItemAtPath:))]
1247        #[unsafe(method_family = none)]
1248        fn fileManager_shouldProceedAfterError_removingItemAtPath(
1249            &self,
1250            file_manager: &NSFileManager,
1251            error: &NSError,
1252            path: &NSString,
1253        ) -> bool;
1254
1255        #[cfg(all(feature = "NSError", feature = "NSURL"))]
1256        #[optional]
1257        #[unsafe(method(fileManager:shouldProceedAfterError:removingItemAtURL:))]
1258        #[unsafe(method_family = none)]
1259        fn fileManager_shouldProceedAfterError_removingItemAtURL(
1260            &self,
1261            file_manager: &NSFileManager,
1262            error: &NSError,
1263            url: &NSURL,
1264        ) -> bool;
1265    }
1266);
1267
1268extern_class!(
1269    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdirectoryenumerator?language=objc)
1270    #[unsafe(super(NSEnumerator<ObjectType>, NSObject))]
1271    #[derive(Debug, PartialEq, Eq, Hash)]
1272    #[cfg(feature = "NSEnumerator")]
1273    pub struct NSDirectoryEnumerator<ObjectType: ?Sized = AnyObject>;
1274);
1275
1276#[cfg(feature = "NSEnumerator")]
1277impl<ObjectType: ?Sized + Message> NSDirectoryEnumerator<ObjectType> {
1278    /// Unchecked conversion of the generic parameter.
1279    ///
1280    /// # Safety
1281    ///
1282    /// The generic must be valid to reinterpret as the given type.
1283    #[inline]
1284    pub unsafe fn cast_unchecked<NewObjectType: ?Sized + Message>(
1285        &self,
1286    ) -> &NSDirectoryEnumerator<NewObjectType> {
1287        unsafe { &*((self as *const Self).cast()) }
1288    }
1289}
1290
1291#[cfg(feature = "NSEnumerator")]
1292extern_conformance!(
1293    unsafe impl<ObjectType: ?Sized> NSFastEnumeration for NSDirectoryEnumerator<ObjectType> {}
1294);
1295
1296#[cfg(feature = "NSEnumerator")]
1297extern_conformance!(
1298    unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSDirectoryEnumerator<ObjectType> {}
1299);
1300
1301#[cfg(feature = "NSEnumerator")]
1302impl<ObjectType: Message> NSDirectoryEnumerator<ObjectType> {
1303    extern_methods!(
1304        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
1305        #[unsafe(method(fileAttributes))]
1306        #[unsafe(method_family = none)]
1307        pub fn fileAttributes(
1308            &self,
1309        ) -> Option<Retained<NSDictionary<NSFileAttributeKey, AnyObject>>>;
1310
1311        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
1312        #[unsafe(method(directoryAttributes))]
1313        #[unsafe(method_family = none)]
1314        pub fn directoryAttributes(
1315            &self,
1316        ) -> Option<Retained<NSDictionary<NSFileAttributeKey, AnyObject>>>;
1317
1318        #[unsafe(method(isEnumeratingDirectoryPostOrder))]
1319        #[unsafe(method_family = none)]
1320        pub fn isEnumeratingDirectoryPostOrder(&self) -> bool;
1321
1322        #[unsafe(method(skipDescendents))]
1323        #[unsafe(method_family = none)]
1324        pub fn skipDescendents(&self);
1325
1326        #[unsafe(method(level))]
1327        #[unsafe(method_family = none)]
1328        pub fn level(&self) -> NSUInteger;
1329
1330        #[unsafe(method(skipDescendants))]
1331        #[unsafe(method_family = none)]
1332        pub fn skipDescendants(&self);
1333    );
1334}
1335
1336/// Methods declared on superclass `NSObject`.
1337#[cfg(feature = "NSEnumerator")]
1338impl<ObjectType: Message> NSDirectoryEnumerator<ObjectType> {
1339    extern_methods!(
1340        #[unsafe(method(init))]
1341        #[unsafe(method_family = init)]
1342        pub fn init(this: Allocated<Self>) -> Retained<Self>;
1343
1344        #[unsafe(method(new))]
1345        #[unsafe(method_family = new)]
1346        pub fn new() -> Retained<Self>;
1347    );
1348}
1349
1350#[cfg(feature = "NSEnumerator")]
1351impl<ObjectType: Message> DefaultRetained for NSDirectoryEnumerator<ObjectType> {
1352    #[inline]
1353    fn default_retained() -> Retained<Self> {
1354        Self::new()
1355    }
1356}
1357
1358extern_class!(
1359    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileproviderservice?language=objc)
1360    #[unsafe(super(NSObject))]
1361    #[derive(Debug, PartialEq, Eq, Hash)]
1362    pub struct NSFileProviderService;
1363);
1364
1365extern_conformance!(
1366    unsafe impl NSObjectProtocol for NSFileProviderService {}
1367);
1368
1369impl NSFileProviderService {
1370    extern_methods!(
1371        #[cfg(all(feature = "NSError", feature = "NSXPCConnection", feature = "block2"))]
1372        /// # Safety
1373        ///
1374        /// `completion_handler` block must be sendable.
1375        #[unsafe(method(getFileProviderConnectionWithCompletionHandler:))]
1376        #[unsafe(method_family = none)]
1377        pub unsafe fn getFileProviderConnectionWithCompletionHandler(
1378            &self,
1379            completion_handler: &block2::DynBlock<dyn Fn(*mut NSXPCConnection, *mut NSError)>,
1380        );
1381
1382        #[cfg(feature = "NSString")]
1383        #[unsafe(method(name))]
1384        #[unsafe(method_family = none)]
1385        pub fn name(&self) -> Retained<NSFileProviderServiceName>;
1386    );
1387}
1388
1389/// Methods declared on superclass `NSObject`.
1390impl NSFileProviderService {
1391    extern_methods!(
1392        #[unsafe(method(init))]
1393        #[unsafe(method_family = init)]
1394        pub fn init(this: Allocated<Self>) -> Retained<Self>;
1395
1396        #[unsafe(method(new))]
1397        #[unsafe(method_family = new)]
1398        pub fn new() -> Retained<Self>;
1399    );
1400}
1401
1402impl DefaultRetained for NSFileProviderService {
1403    #[inline]
1404    fn default_retained() -> Retained<Self> {
1405        Self::new()
1406    }
1407}
1408
1409extern "C" {
1410    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfiletype?language=objc)
1411    #[cfg(feature = "NSString")]
1412    pub static NSFileType: &'static NSFileAttributeKey;
1413}
1414
1415extern "C" {
1416    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfiletypedirectory?language=objc)
1417    #[cfg(feature = "NSString")]
1418    pub static NSFileTypeDirectory: &'static NSFileAttributeType;
1419}
1420
1421extern "C" {
1422    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfiletyperegular?language=objc)
1423    #[cfg(feature = "NSString")]
1424    pub static NSFileTypeRegular: &'static NSFileAttributeType;
1425}
1426
1427extern "C" {
1428    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfiletypesymboliclink?language=objc)
1429    #[cfg(feature = "NSString")]
1430    pub static NSFileTypeSymbolicLink: &'static NSFileAttributeType;
1431}
1432
1433extern "C" {
1434    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfiletypesocket?language=objc)
1435    #[cfg(feature = "NSString")]
1436    pub static NSFileTypeSocket: &'static NSFileAttributeType;
1437}
1438
1439extern "C" {
1440    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfiletypecharacterspecial?language=objc)
1441    #[cfg(feature = "NSString")]
1442    pub static NSFileTypeCharacterSpecial: &'static NSFileAttributeType;
1443}
1444
1445extern "C" {
1446    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfiletypeblockspecial?language=objc)
1447    #[cfg(feature = "NSString")]
1448    pub static NSFileTypeBlockSpecial: &'static NSFileAttributeType;
1449}
1450
1451extern "C" {
1452    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfiletypeunknown?language=objc)
1453    #[cfg(feature = "NSString")]
1454    pub static NSFileTypeUnknown: &'static NSFileAttributeType;
1455}
1456
1457extern "C" {
1458    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilesize?language=objc)
1459    #[cfg(feature = "NSString")]
1460    pub static NSFileSize: &'static NSFileAttributeKey;
1461}
1462
1463extern "C" {
1464    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilemodificationdate?language=objc)
1465    #[cfg(feature = "NSString")]
1466    pub static NSFileModificationDate: &'static NSFileAttributeKey;
1467}
1468
1469extern "C" {
1470    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilereferencecount?language=objc)
1471    #[cfg(feature = "NSString")]
1472    pub static NSFileReferenceCount: &'static NSFileAttributeKey;
1473}
1474
1475extern "C" {
1476    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfiledeviceidentifier?language=objc)
1477    #[cfg(feature = "NSString")]
1478    pub static NSFileDeviceIdentifier: &'static NSFileAttributeKey;
1479}
1480
1481extern "C" {
1482    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileowneraccountname?language=objc)
1483    #[cfg(feature = "NSString")]
1484    pub static NSFileOwnerAccountName: &'static NSFileAttributeKey;
1485}
1486
1487extern "C" {
1488    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilegroupowneraccountname?language=objc)
1489    #[cfg(feature = "NSString")]
1490    pub static NSFileGroupOwnerAccountName: &'static NSFileAttributeKey;
1491}
1492
1493extern "C" {
1494    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileposixpermissions?language=objc)
1495    #[cfg(feature = "NSString")]
1496    pub static NSFilePosixPermissions: &'static NSFileAttributeKey;
1497}
1498
1499extern "C" {
1500    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilesystemnumber?language=objc)
1501    #[cfg(feature = "NSString")]
1502    pub static NSFileSystemNumber: &'static NSFileAttributeKey;
1503}
1504
1505extern "C" {
1506    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilesystemfilenumber?language=objc)
1507    #[cfg(feature = "NSString")]
1508    pub static NSFileSystemFileNumber: &'static NSFileAttributeKey;
1509}
1510
1511extern "C" {
1512    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileextensionhidden?language=objc)
1513    #[cfg(feature = "NSString")]
1514    pub static NSFileExtensionHidden: &'static NSFileAttributeKey;
1515}
1516
1517extern "C" {
1518    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilehfscreatorcode?language=objc)
1519    #[cfg(feature = "NSString")]
1520    pub static NSFileHFSCreatorCode: &'static NSFileAttributeKey;
1521}
1522
1523extern "C" {
1524    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilehfstypecode?language=objc)
1525    #[cfg(feature = "NSString")]
1526    pub static NSFileHFSTypeCode: &'static NSFileAttributeKey;
1527}
1528
1529extern "C" {
1530    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileimmutable?language=objc)
1531    #[cfg(feature = "NSString")]
1532    pub static NSFileImmutable: &'static NSFileAttributeKey;
1533}
1534
1535extern "C" {
1536    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileappendonly?language=objc)
1537    #[cfg(feature = "NSString")]
1538    pub static NSFileAppendOnly: &'static NSFileAttributeKey;
1539}
1540
1541extern "C" {
1542    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilecreationdate?language=objc)
1543    #[cfg(feature = "NSString")]
1544    pub static NSFileCreationDate: &'static NSFileAttributeKey;
1545}
1546
1547extern "C" {
1548    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileowneraccountid?language=objc)
1549    #[cfg(feature = "NSString")]
1550    pub static NSFileOwnerAccountID: &'static NSFileAttributeKey;
1551}
1552
1553extern "C" {
1554    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilegroupowneraccountid?language=objc)
1555    #[cfg(feature = "NSString")]
1556    pub static NSFileGroupOwnerAccountID: &'static NSFileAttributeKey;
1557}
1558
1559extern "C" {
1560    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilebusy?language=objc)
1561    #[cfg(feature = "NSString")]
1562    pub static NSFileBusy: &'static NSFileAttributeKey;
1563}
1564
1565extern "C" {
1566    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileprotectionkey?language=objc)
1567    #[cfg(feature = "NSString")]
1568    pub static NSFileProtectionKey: &'static NSFileAttributeKey;
1569}
1570
1571extern "C" {
1572    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileprotectionnone?language=objc)
1573    #[cfg(feature = "NSString")]
1574    pub static NSFileProtectionNone: &'static NSFileProtectionType;
1575}
1576
1577extern "C" {
1578    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileprotectioncomplete?language=objc)
1579    #[cfg(feature = "NSString")]
1580    pub static NSFileProtectionComplete: &'static NSFileProtectionType;
1581}
1582
1583extern "C" {
1584    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileprotectioncompleteunlessopen?language=objc)
1585    #[cfg(feature = "NSString")]
1586    pub static NSFileProtectionCompleteUnlessOpen: &'static NSFileProtectionType;
1587}
1588
1589extern "C" {
1590    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileprotectioncompleteuntilfirstuserauthentication?language=objc)
1591    #[cfg(feature = "NSString")]
1592    pub static NSFileProtectionCompleteUntilFirstUserAuthentication: &'static NSFileProtectionType;
1593}
1594
1595extern "C" {
1596    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfileprotectioncompletewhenuserinactive?language=objc)
1597    #[cfg(feature = "NSString")]
1598    pub static NSFileProtectionCompleteWhenUserInactive: &'static NSFileProtectionType;
1599}
1600
1601extern "C" {
1602    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilesystemsize?language=objc)
1603    #[cfg(feature = "NSString")]
1604    pub static NSFileSystemSize: &'static NSFileAttributeKey;
1605}
1606
1607extern "C" {
1608    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilesystemfreesize?language=objc)
1609    #[cfg(feature = "NSString")]
1610    pub static NSFileSystemFreeSize: &'static NSFileAttributeKey;
1611}
1612
1613extern "C" {
1614    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilesystemnodes?language=objc)
1615    #[cfg(feature = "NSString")]
1616    pub static NSFileSystemNodes: &'static NSFileAttributeKey;
1617}
1618
1619extern "C" {
1620    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsfilesystemfreenodes?language=objc)
1621    #[cfg(feature = "NSString")]
1622    pub static NSFileSystemFreeNodes: &'static NSFileAttributeKey;
1623}
1624
1625/// NSFileAttributes.
1626#[cfg(feature = "NSDictionary")]
1627impl<KeyType: Message, ObjectType: Message> NSDictionary<KeyType, ObjectType> {
1628    extern_methods!(
1629        #[unsafe(method(fileSize))]
1630        #[unsafe(method_family = none)]
1631        pub fn fileSize(&self) -> c_ulonglong;
1632
1633        #[cfg(feature = "NSDate")]
1634        #[unsafe(method(fileModificationDate))]
1635        #[unsafe(method_family = none)]
1636        pub fn fileModificationDate(&self) -> Option<Retained<NSDate>>;
1637
1638        #[cfg(feature = "NSString")]
1639        #[unsafe(method(fileType))]
1640        #[unsafe(method_family = none)]
1641        pub fn fileType(&self) -> Option<Retained<NSString>>;
1642
1643        #[unsafe(method(filePosixPermissions))]
1644        #[unsafe(method_family = none)]
1645        pub fn filePosixPermissions(&self) -> NSUInteger;
1646
1647        #[cfg(feature = "NSString")]
1648        #[unsafe(method(fileOwnerAccountName))]
1649        #[unsafe(method_family = none)]
1650        pub fn fileOwnerAccountName(&self) -> Option<Retained<NSString>>;
1651
1652        #[cfg(feature = "NSString")]
1653        #[unsafe(method(fileGroupOwnerAccountName))]
1654        #[unsafe(method_family = none)]
1655        pub fn fileGroupOwnerAccountName(&self) -> Option<Retained<NSString>>;
1656
1657        #[unsafe(method(fileSystemNumber))]
1658        #[unsafe(method_family = none)]
1659        pub fn fileSystemNumber(&self) -> NSInteger;
1660
1661        #[unsafe(method(fileSystemFileNumber))]
1662        #[unsafe(method_family = none)]
1663        pub fn fileSystemFileNumber(&self) -> NSUInteger;
1664
1665        #[unsafe(method(fileExtensionHidden))]
1666        #[unsafe(method_family = none)]
1667        pub fn fileExtensionHidden(&self) -> bool;
1668
1669        #[unsafe(method(fileHFSCreatorCode))]
1670        #[unsafe(method_family = none)]
1671        pub fn fileHFSCreatorCode(&self) -> OSType;
1672
1673        #[unsafe(method(fileHFSTypeCode))]
1674        #[unsafe(method_family = none)]
1675        pub fn fileHFSTypeCode(&self) -> OSType;
1676
1677        #[unsafe(method(fileIsImmutable))]
1678        #[unsafe(method_family = none)]
1679        pub fn fileIsImmutable(&self) -> bool;
1680
1681        #[unsafe(method(fileIsAppendOnly))]
1682        #[unsafe(method_family = none)]
1683        pub fn fileIsAppendOnly(&self) -> bool;
1684
1685        #[cfg(feature = "NSDate")]
1686        #[unsafe(method(fileCreationDate))]
1687        #[unsafe(method_family = none)]
1688        pub fn fileCreationDate(&self) -> Option<Retained<NSDate>>;
1689
1690        #[cfg(feature = "NSValue")]
1691        #[unsafe(method(fileOwnerAccountID))]
1692        #[unsafe(method_family = none)]
1693        pub fn fileOwnerAccountID(&self) -> Option<Retained<NSNumber>>;
1694
1695        #[cfg(feature = "NSValue")]
1696        #[unsafe(method(fileGroupOwnerAccountID))]
1697        #[unsafe(method_family = none)]
1698        pub fn fileGroupOwnerAccountID(&self) -> Option<Retained<NSNumber>>;
1699    );
1700}