Platforms to show: All Mac Windows Linux Cross-Platform
NSFileCoordinatorMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | iCloud | MBS MacCloud Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Please also check the documentation from Apple for the NSFileCoordinator class.
- 4 events
- event coordinateReadingItemAtURL(url as string, file as folderitem, tag as Variant)
- event coordinateReadingItemAtURLwritingItemAtURL(readingURL as string, readingFile as folderitem, writingURL as string, writingFile as folderitem, tag as Variant)
- event coordinateWritingItemAtURL(url as string, file as folderitem, tag as Variant)
- event prepareComplete(Complete as NSFilePresenterHandlerMBS, tag as Variant)
- property Handle as Integer
- 12 methods
- method cancel
- method Constructor(filePresenter as NSFilePresenterMBS = nil)
- method coordinateReadingItemAtURL(File as folderitem, options as Integer, byref error as NSErrorMBS, tag as Variant = nil)
- method coordinateReadingItemAtURL(URL as string, options as Integer, byref error as NSErrorMBS, tag as Variant = nil)
- method coordinateReadingItemAtURLwritingItemAtURL(readingFile as folderitem, readingOptions as Integer, writingItemAtFile as folderitem, writingOptions as Integer, byref error as NSErrorMBS, tag as Variant = nil)
- method coordinateReadingItemAtURLwritingItemAtURL(readingURL as string, readingOptions as Integer, writingItemAtURL as string, writingOptions as Integer, byref error as NSErrorMBS, tag as Variant = nil)
- method coordinateWritingItemAtURL(File as folderitem, options as Integer, byref error as NSErrorMBS, tag as Variant = nil)
- method coordinateWritingItemAtURL(URL as string, options as Integer, byref error as NSErrorMBS, tag as Variant = nil)
- method itemAtURLdidMoveToURL(oldURL as string, newURL as string)
- method itemAtURLwillMoveToURL(oldURL as string, newURL as string)
- method prepareForReadingItemsAtURLs(readingFiles() as folderitem, readingOptions as Integer, writingItemsAtFiles() as folderitem, writingOptions as Integer, byref error as NSErrorMBS, tag as Variant = nil)
- method prepareForReadingItemsAtURLs(readingURLs() as string, readingOptions as Integer, writingItemsAtURLs() as string, writingOptions as Integer, byref error as NSErrorMBS, tag as Variant = nil)
- 4 shared methods
- shared method addFilePresenter(filePresenter as NSFilePresenterMBS)
- shared method filePresenters as NSFilePresenterMBS()
- shared method FileURL(file as folderitem) as string
- shared method removeFilePresenter(filePresenter as NSFilePresenterMBS)
- 6 constants
Reading flag constants.
Constant | Value | Description |
---|---|---|
NSFileCoordinatorReadingResolvesSymbolicLink | 2 |
Whether reading of an item that might be a symbolic link file causes the resolution of the link if it is. This affects the URL passed to the block passed to an invocation of one of the coordinateReadingItemAtURL... methods. This is not a valid option to use with prepareForReadingItemsAtURLs. |
NSFileCoordinatorReadingWithoutChanges | 1 |
Whether reading does _not_ trigger sending of savePresentedItemChangesWithCompletionHandler to certain NSFilePresenters in the system and waiting for those NSFilePresenters to respond. The default behavior during coordinated reading is to send savePresentedItemChangesWithCompletionHandler to NSFilePresenters. |
Writing flag constants.
Constant | Value | Description |
---|---|---|
NSFileCoordinatorWritingForDeleting | 1 | Whether the writing to be done is actually the deletion of the item. This affects how the writing waits for previously scheduled coordinated reading and writing, how the writing causes subsequently scheduled reading and writing to wait, and what NSFilePresenter messaging is done. See the comments in the Single File Coordination section below. This option is how you trigger sending of accommodatePresentedItemDeletionWithCompletionHandler or accommodatePresentedSubitemDeletionAtURL messages to NSFilePresenters. more |
NSFileCoordinatorWritingForMerging | 4 |
Whether coordinated writing triggers sending of savePresentedItemChangesWithCompletionHandler to certain NSFilePresenters in the system and waiting for those NSFilePresenters to respond. |
NSFileCoordinatorWritingForMoving | 2 | Whether the writing to be done is actually the moving or renaming of the item. This affects how the writing waits for previously scheduled coordinated reading and writing, how the writing causes subsequently scheduled reading and writing to wait, and what NSFilePresenter messaging is done. See the comments in the Single File Coordination section below. This option has no effect when what's being moved is a plain file so you can use it in code that moves file system items without checking whether the items are files or directories. Any such check would invite a race condition anyway. more |
NSFileCoordinatorWritingForReplacing | 8 | Whether the writing to be done is actually the replacement of the item with a different item. It causes the same behavior as NSFileCoordinatorWritingForDeleting except that when the item being written to is renamed or moved while the writer is being made to wait the item is considered to have been a different item, so the writer is not passed an updated URL to reflect the renaming or moving. Use this when the moving or creation of an item will replace any item that gets in its way. To avoid a race condition use it regardless of whether there is actually an item in the way before the writing begins. Don't use this when simply updating the contents of a file, even if the way you do that is writing the contents to another file and renaming it into place. This is not a valid option to use with prepareForReadingItemsAtURLs. more |
This class has no sub classes.
Blog Entries
- Managing File Access in Xojo with NSFileCoordinator
- MBS Xojo / Real Studio Plugins, version 14.2pr10
- MBS Real Studio Plugins, version 13.1pr9
- MBS Real Studio Plugins, version 11.3pr9
Release notes
- Version 24.4
- Fixed NSFileCoordinatorMBS constructor to accept nil parameter.
The items on this page are in the following plugins: MBS MacCloud Plugin.
NSExpressionMBS - NSFileHandleMBS