Platforms to show: All Mac Windows Linux Cross-Platform
NSFileManagerMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | iCloud | MBS MacCocoa Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
In Xojo you can do the same with folderitem. But for some iCloud related tasks you need to use this class.
In Cocoa applications, a file manager object is usually your first interaction with the file system. You use this object to locate, create, copy, and move files and directories. You also use this object to get information about files and directories, such as its size, modification date, and BSD permissions. You can also use a file manager object to change the values of many file and directory attributes.
The NSFileManagerMBS class supports both the folderitem and path string as ways to specify the location of a file or directory. The use of the folderitem is generally preferred for specifying file-system items because they can convert path information to a more efficient representation internally. You can also obtain a bookmark from an folderitem, which is similar to an alias and offers a more sure way of locating the file or directory later.
In iOS 5.0 and later and in Mac OS X v10.7 and later, NSFileManager includes methods for managing items stored in the cloud. Files and directories tagged for cloud storage are synced to the user's MobileMe account so that they can be made available to the user's iOS devices and Macintosh computers. Changes to an item in one location are propagated to all other locations to ensure the items stay in sync.
- 5 properties
- property currentDirectory as folderitem
- property currentDirectoryPath as string
- property Handle as Integer
- property homeDirectoryForCurrentUser as FolderITem
- property temporaryDirectory as FolderITem
- shared property defaultManager as NSFileManagerMBS
- 53 methods
- method attributesOfFileSystemForPath(item as folderitem, byref error as NSErrorMBS) as Dictionary
- method attributesOfFileSystemForPath(path as string, byref error as NSErrorMBS) as Dictionary
- method attributesOfItemAtPath(item as folderitem, byref error as NSErrorMBS) as Dictionary
- method attributesOfItemAtPath(path as string, byref error as NSErrorMBS) as Dictionary
- method changeCurrentDirectory(folder as folderitem) as boolean
- method changeCurrentDirectory(path as string) as boolean
- method Constructor
- method containerFolderForSecurityApplicationGroupIdentifier(groupIdentifier as string) as folderItem
- method containerURLForSecurityApplicationGroupIdentifier(groupIdentifier as string) as string
- method contentsEqual(path1 as folderitem, path2 as folderitem) as boolean
- method copyItem(source as folderItem, dest as folderItem, byref error as NSErrorMBS) as boolean
- method copyItem(sourcePath as String, destPath as String, byref error as NSErrorMBS) as boolean
- method copyItemMT(source as folderItem, dest as folderItem, byref error as NSErrorMBS) as boolean
- method copyItemMT(sourcePath as String, destPath as String, byref error as NSErrorMBS) as boolean
- method createDirectory(Path as folderItem, createIntermediates as boolean = true, attrs as Dictionary = nil, byref error as NSErrorMBS) as boolean
- method createDirectory(Path as String, createIntermediates as boolean = true, attrs as Dictionary = nil, byref error as NSErrorMBS) as boolean
- method createFile(Path as folderItem, contents as MemoryBlock, attrs as Dictionary = nil) as boolean
- method createFile(Path as String, contents as MemoryBlock, attrs as Dictionary = nil) as boolean
- method createSymbolicLink(file as folderitem, destFile as folderitem, byref error as NSErrorMBS) as boolean
- method createSymbolicLink(path as string, destPath as string, byref error as NSErrorMBS) as boolean
- method destinationOfSymbolicLinkAtPath(file as folderitem, byref error as NSErrorMBS) as string
- method destinationOfSymbolicLinkAtPath(path as string, byref error as NSErrorMBS) as string
- method displayName(path as folderitem) as string
- method evictUbiquitousItem(item as folderitem, byref error as NSErrorMBS) as boolean
- method fileExists(path as folderitem) as boolean
- method fileExists(path as folderitem, byref isDirectory as boolean) as boolean
- method FileForUbiquityContainerIdentifier(containerIdentifier as string) as folderitem
- method homeDirectoryForUser(Name as string) as FolderItem
- method isDeletableFile(path as folderitem) as boolean
- method isExecutableFile(path as folderitem) as boolean
- method isReadableFile(path as folderitem) as boolean
- method isUbiquitousItem(item as folderitem) as boolean
- method isUbiquitousItem(URL as string) as boolean
- method isWritableFile(path as folderitem) as boolean
- method linkItem(source as folderItem, dest as folderItem, byref error as NSErrorMBS) as boolean
- method linkItem(sourcePath as String, destPath as String, byref error as NSErrorMBS) as boolean
- method moveItem(source as folderItem, dest as folderItem, byref error as NSErrorMBS) as boolean
- method moveItem(sourcePath as String, destPath as String, byref error as NSErrorMBS) as boolean
- method removeItem(file as folderitem, byref error as NSErrorMBS) as boolean
- method removeItem(path as string, byref error as NSErrorMBS) as boolean
- method replaceItem(originalItem as FolderItem, newItem as FolderItem, backupItemName as String, options as integer, byref resultingItem as FolderItem, byref error as NSErrorMBS) as Boolean
- method replaceItemAtURL(originalItemURL as string, newItemURL as String, backupItemName as String, options as integer, byref resultingURL as String, byref error as NSErrorMBS) as Boolean
- method setAttributes(attributesDic as dictionary, item as folderitem, byref error as NSErrorMBS) as boolean
- method setAttributes(attributesDic as dictionary, path as string, byref error as NSErrorMBS) as boolean
- method setUbiquitous(flag as boolean, item as folderitem, destitem as folderitem, byref error as NSErrorMBS) as boolean
- method setUbiquitous(flag as boolean, item as folderitem, destURL as string, byref error as NSErrorMBS) as boolean
- method startDownloadingUbiquitousItem(item as folderitem, byref error as NSErrorMBS) as boolean
- method startDownloadingUbiquitousItem(URL as string, byref error as NSErrorMBS) as boolean
- method trashItem(file as folderItem, byref Resulting as folderItem, byref error as NSErrorMBS) as boolean
- method trashItem(Path as String, byref Resulting as FolderItem, byref error as NSErrorMBS) as boolean
- method URLForPublishingUbiquitousItem(item as folderitem, byref expirationDate as date, byref error as NSErrorMBS) as string
- method URLForPublishingUbiquitousItem(URL as string, byref expirationDate as date, byref error as NSErrorMBS) as string
- method URLForUbiquityContainerIdentifier(containerIdentifier as string) as string
- 50 shared methods
- shared method fileManagerWithAuthorization(authorization as NSWorkspaceAuthorizationMBS) as NSFileManagerMBS
- shared method lastPathComponent(pathOrURL as string) as string
- shared method NSFileAppendOnly as string
- shared method NSFileBusy as string
- shared method NSFileCreationDate as string
- shared method NSFileDeviceIdentifier as string
- shared method NSFileExtensionHidden as string
- shared method NSFileGroupOwnerAccountID as string
- shared method NSFileGroupOwnerAccountName as string
- shared method NSFileHFSCreatorCode as string
- shared method NSFileHFSTypeCode as string
- shared method NSFileImmutable as string
- shared method NSFileManagerUnmountDissentingProcessIdentifierErrorKey as string
- shared method NSFileModificationDate as string
- shared method NSFileOwnerAccountID as string
- shared method NSFileOwnerAccountName as string
- shared method NSFilePosixPermissions as string
- shared method NSFileReferenceCount as string
- shared method NSFileSize as string
- shared method NSFileSystemFileNumber as string
- shared method NSFileSystemFreeNodes as string
- shared method NSFileSystemFreeSize as string
- shared method NSFileSystemNodes as string
- shared method NSFileSystemNumber as string
- shared method NSFileSystemSize as string
- shared method NSFileType as string
- shared method NSFileTypeBlockSpecial as string
- shared method NSFileTypeCharacterSpecial as string
- shared method NSFileTypeDirectory as string
- shared method NSFileTypeRegular as string
- shared method NSFileTypeSocket as string
- shared method NSFileTypeSymbolicLink as string
- shared method NSFileTypeUnknown as string
- shared method NSUbiquityIdentityDidChangeNotification as string
- shared method pathExtension(pathOrURL as string) as string
- shared method stringByAbbreviatingWithTildeInPath(path as string) as string
- shared method stringByAppendingPathComponent(path as string, Component as string) as string
- shared method stringByAppendingPathExtension(path as string, Extension as string) as string
- shared method stringByDeletingLastPathComponent(path as string) as string
- shared method stringByDeletingPathExtension(path as string) as string
- shared method stringByExpandingTildeInPath(path as string) as string
- shared method stringByResolvingSymlinksInPath(path as string) as string
- shared method stringByStandardizingPath(path as string) as string
- shared method URLByAppendingPathComponent(URL as string, pathComponent as string) as string
- shared method URLByAppendingPathComponent(URL as string, pathComponent as string, isDirectory as boolean) as string
- shared method URLByAppendingPathExtension(URL as string, pathExtension as string) as string
- shared method URLByDeletingLastPathComponent(URL as string) as string
- shared method URLByDeletingPathExtension(URL as string) as string
- shared method URLByResolvingSymlinksInPath(URL as string) as string
- shared method URLByStandardizingPath(URL as string) as string
- 12 constants
Constants
Constant | Value | Description |
---|---|---|
NSDirectoryEnumerationSkipsHiddenFiles | 4 |
One of the option constants for enumerating the contents of directories with the contentsOfDirectoryAtURL method.
Do not enumerate hidden files. Available in Mac OS X v10.6 and later. |
NSDirectoryEnumerationSkipsPackageDescendants | 2 |
One of the option constants for enumerating the contents of directories with the contentsOfDirectoryAtURL method.
Do not descend into packages. Available in Mac OS X v10.6 and later. |
NSDirectoryEnumerationSkipsSubdirectoryDescendants | 1 |
One of the option constants for enumerating the contents of directories with the contentsOfDirectoryAtURL method.
Perform a shallow enumeration; do not descend into directories. Available in Mac OS X v10.6 and later. |
NSFileManagerItemReplacementUsingNewMetadataOnly | 1 | One of the options constants to specify the replacement behavior in NSFileManagerItemReplacementWithoutDeletingBackupItem. Causes NSFileManagerItemReplacementWithoutDeletingBackupItem to use metadata from the new item only and not to attempt to preserve metadata from the original item. more |
NSFileManagerItemReplacementWithoutDeletingBackupItem | 2 | One of the options constants to specify the replacement behavior in NSFileManagerItemReplacementWithoutDeletingBackupItem. Causes NSFileManagerItemReplacementWithoutDeletingBackupItem to leave the backup item in place after a successful replacement. The default behavior is to remove the item. more |
NSVolumeEnumerationProduceFileReferenceURLs | 4 |
One of the option constants for enumerating mounted volumes with the mountedVolumeURLsIncludingResourceValuesForKeys method.
The enumeration produces file reference URLs rather than path-based URLs. Available in Mac OS X v10.6 and later. |
NSVolumeEnumerationSkipHiddenVolumes | 2 |
One of the option constants for enumerating mounted volumes with the mountedVolumeURLsIncludingResourceValuesForKeys method.
The enumeration skips hidden volumes. Available in Mac OS X v10.6 and later. |
Unmount options
Constant | Value | Description |
---|---|---|
NSFileManagerUnmountAllPartitionsAndEjectDisk | 1 |
Unmount all partitions of this disk and eject it. |
NSFileManagerUnmountWithoutUI | 2 |
Unmount without user interface. |
Relationships
Constant | Value | Description |
---|---|---|
NSURLRelationshipContains | 0 |
The directory contains the specified item. |
NSURLRelationshipOther | 2 |
The directory does not contain the item and is not the same as the item. |
NSURLRelationshipSame | 1 |
The directory and the item are the same. This relationship occurs when the value of the NSURLFileResourceIdentifierKey is the same for the directory and item. |
This class has no sub classes.
Some properties using for this class:
- NSFileManagerMBS.defaultManager as NSFileManagerMBS
Some examples using this class:
Blog Entries
- CallKit extension for Xojo iOS application
- Multithreaded plugin functions can increase speed of Xojo application
- MBS Xojo Plugins, version 19.5pr6
- MonkeyBread Software Releases the MBS Xojo Plugins in version 19.3
- MBS Xojo Plugins, version 19.3pr3
- MBS Xojo Plugins, version 18.5pr1
- MBS Xojo Plugins, version 18.2pr1
- MBS Xojo / Real Studio Plugins, version 16.5pr7
- MBS Xojo / Real Studio Plugins, version 16.4pr4
- Notes...
Xojo Developer Magazine
Release notes
- Version 19.5
- Added path variants for copyItem, copyItemMT, linkItem, moveItem, trashItem in NSFileManagerMBS class.
- Version 19.3
- Added NSFileManagerMBS.fileManagerWithAuthorization method.
- Added replaceItemAtURL methods for NSFileManagerMBS class.
- Upgraded NSFileManagerMBS.createSymbolicLink to use createSymbolicLinkAtURL if available.
- Version 18.5
- Added more methods for NSFileManagerMBS.
- Changed methods in NSFileManagerMBS to be regular ones, not shared. This is needed as we may have multiple file managers.
- Version 18.2
- Added NSFileManagerMBS.copyItemMT function.
The items on this page are in the following plugins: MBS MacCocoa Plugin.
NSFileHandleMBS - NSFilePresenterHandlerMBS