Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSFileWrapperMBS class.

NSFileWrapperMBS.Directory as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
This property contains a boolean value indicating whether the file wrapper is a directory file wrapper. (read-only)

This property will contain true when the file wrapper is a directory file wrapper, otherwise it contains false.
Invocations of readFromURL may change the value of this property, if the type of the file on disk has changed.
(Read only property)

NSFileWrapperMBS.fileAttributes as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
A dictionary of file attributes.
Example
dim file as FolderItem = SpecialFolder.desktop.child("todo.rtf")
dim e as NSErrorMBS
dim f as NSFileWrapperMBS = NSFileWrapperMBS.initWithFile(file, 0, e)

if e <> nil then
MsgBox e.localizedDescription
else
dim dic as Dictionary = f.fileAttributes
Break // read dic in debugger
end if

The file attributes’ dictionary is the same format as that returned by attributesOfItemAtPath (see NSFileManagerMBS).
(Read and Write property)

NSFileWrapperMBS.filename as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The filename of the file wrapper object.
Example
dim content as MemoryBlock = "Hello World"
dim f as NSFileWrapperMBS = NSFileWrapperMBS.initRegularFileWithContents(content)
f.filename = "HelloWorld.txt"

This property contains the file wrapper’s filename, or nil when the file wrapper has no corresponding file-system node.

The filename is used for record-keeping purposes only and is set automatically when the file wrapper is created from the file system using initWithURL and when it’s saved to the file system using writeToURL (although this method allows you to request that the filename not be updated).

The filename is usually the same as the preferred filename, but might instead be a name derived from the preferred filename. You can use this method to get the name of a child that's just been read. Don’t use this method to get the name of a child that's about to be written, because the name might be about to change; send keyForFileWrapper to the parent instead.
(Read and Write property)

NSFileWrapperMBS.fileWrappers as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 16.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The file wrappers contained by a directory file wrapper.

The dictionary contains entries whose values are the file wrappers and whose keys are the unique filenames that have been assigned to each one. See Working with Directory Wrappers in File System Programming Guide for more information about the file-wrapper list structure.

This property may contain nil if the user modifies the directory after you call readFromURL or initWithURL but before NSFileWrapper has read the contents of the directory. Use the NSFileWrapperReadingImmediate reading option to reduce the likelihood of that problem.

This property raises NSInternalInconsistencyException if the file wrapper object is not a directory file wrapper.
(Read only property)

NSFileWrapperMBS.Handle as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The internal object reference.

Must not be 0 to have the object being valid.
(Read and Write property)

NSFileWrapperMBS.icon as NSImageMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
An image that can be used to represent the file wrapper to the user.
Example
dim file as FolderItem = SpecialFolder.desktop.child("todo.rtf")
dim e as NSErrorMBS
dim f as NSFileWrapperMBS = NSFileWrapperMBS.initWithFile(file, 0, e)
dim img as NSImageMBS = f.icon
dim pic as Picture = img.CopyPictureWithMask
window1.Backdrop = pic

An application does not have to use this icon; for example, a file viewer typically looks up icons automatically based on file extensions, and so wouldn’t need this one. Similarly, if a file wrapper represents an image file, an application can display the image directly rather than a file icon.

This method may return nil if the file wrapper is a child created when its parent was read from the file system, and the child was modified before it was read. Use the NSFileWrapperReadingImmediate reading option to reduce the likelihood of that problem.

Because the NSImage object that's returned might be shared by many NSFileWrapper objects, you must not mutate it. If you need to mutate the returned object, make a copy first and mutate the copy instead.
(Read and Write property)

NSFileWrapperMBS.preferredFilename as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The preferred filename for the file wrapper object.
Example
// get a wrapper
dim file as FolderItem = SpecialFolder.desktop.child("todo.rtf")
dim e as NSErrorMBS
dim f as NSFileWrapperMBS = NSFileWrapperMBS.initWithFile(file, 0, e)
dim data as MemoryBlock = f.serializedRepresentation

// later restore it
dim other as NSFileWrapperMBS = NSFileWrapperMBS.initWithSerializedRepresentation(data)
MsgBox other.preferredFilename

This name is normally used as the dictionary key when a child file wrapper is added to a directory file wrapper. However, if another file wrapper with the same preferred name already exists in the directory file wrapper when this object is added, the filename assigned as the dictionary key may differ from the preferred filename.

When you change the preferred filename, the default implementation of this property causes the existing parent directory file wrappers to remove and re-add the child to accommodate the change. Preferred filenames of children are not preserved when you write a file wrapper to disk and then later instantiate another file wrapper by reading the file from disk. If you need to preserve the user-visible names of attachments, you have to store the names yourself.
(Read and Write property)

NSFileWrapperMBS.RegularFile as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
This property contains a boolean value that indicates whether the file wrapper object is a regular-file. (read-only)

This property contains true when the file wrapper object is a regular-file wrapper, otherwise it contains false. Invocations of readFromURL may change the value of this property if the type of the file on disk has changed.
(Read only property)

NSFileWrapperMBS.regularFileContents as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The contents of the file-system node associated with a regular-file file wrapper. (read-only)

This property may contain nil if the user modifies the file after you call readFromURL or initWithURL but before NSFileWrapper has read the contents of the file. Use the NSFileWrapperReadingImmediate reading option to reduce the likelihood of that problem.
This property raises NSInternalInconsistencyException if the file wrapper object is not a regular-file file wrapper.
(Read only property)

NSFileWrapperMBS.serializedRepresentation as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The contents of the file wrapper as an opaque collection of data. (read-only)
Example
// get a wrapper
dim file as FolderItem = SpecialFolder.desktop.child("todo.rtf")
dim e as NSErrorMBS
dim f as NSFileWrapperMBS = NSFileWrapperMBS.initWithFile(file, 0, e)
dim data as MemoryBlock = f.serializedRepresentation

// later restore it
dim other as NSFileWrapperMBS = NSFileWrapperMBS.initWithSerializedRepresentation(data)
MsgBox other.preferredFilename

This property contains an MemoryBlock in the format used by the pasteboard type NSFileContentsPboardType. This MemoryBlock is also suitable for passing to initWithSerializedRepresentation.

This property may contain nil if the user modifies the contents of the file-system node after you call readFromURL or initWithURL/File but before NSFileWrapper has read the contents of the file. Use the NSFileWrapperReadingImmediate reading option to reduce the likelihood of that problem.
(Read only property)

NSFileWrapperMBS.SymbolicLink as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
A boolean that indicates whether the file wrapper object is a symbolic-link file wrapper. (read-only)

This property contains true when the file wrapper object is a symbolic-link file wrapper, false otherwise.
Invocations of readFromURL may change the value contained by this property, if the type of the file on disk has changed.
(Read only property)

NSFileWrapperMBS.symbolicLinkDestinationURL as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Text MBS MacBase Plugin 15.0 ✅ Yes ❌ No ❌ No ✅ Yes All
The URL referenced by the file wrapper object, which must be a symbolic-link file wrapper. (read-only)

This property may contain nil if the user modifies the symbolic link after you call readFromURL or initWithURL but before NSFileWrapper has read the contents of the link. Use the NSFileWrapperReadingImmediate reading option to reduce the likelihood of that problem.
This property raises NSInternalInconsistencyException if the file wrapper object is not a symbolic-link file wrapper.
(Read only property)

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...