Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

Next items

NSFileManagerMBS.attributesOfItemAtPath(item as folderitem, byref error as NSErrorMBS) as Dictionary
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.3 Yes No No Yes, macOS only No
Function: Returns the attributes of the item at a given path.
Example:
dim n as new NSFileManagerMBS
dim e as NSErrorMBS
dim d as Dictionary = n.attributesOfItemAtPath(SpecialFolder.Desktop, e)

break // check dictionary in debugger
Notes:
item: The folderitem of a file or directory.
Error: If an error occurs, this is set to an actual error object containing the error information.

Return a Dictionary object that describes the attributes (file, directory, symlink, and so on) of the file specified by path. The keys in the dictionary are described in File Attribute Keys. (see NSFile* shared methods)

Special Considerations
This method does not traverse symbolic links. If the item at the path is a symbolic link—that is, the value of the NSFileType key in the attributes dictionary is NSFileTypeSymbolicLink—you can use the destinationOfSymbolicLinkAtPath method to retrieve the path of the item pointed to by the link. You can also use the stringByResolvingSymlinksInPath method of NSString to resolve links in the path before retrieving the item's attributes.

Available in Mac OS X v10.5 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.attributesOfItemAtPath(path as string, byref error as NSErrorMBS) as Dictionary
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.3 Yes No No Yes, macOS only No
Function: Returns the attributes of the item at a given path.
Notes:
path: The path of a file or directory.
Error: If an error occurs, this is set to an actual error object containing the error information.

Return a Dictionary object that describes the attributes (file, directory, symlink, and so on) of the file specified by path. The keys in the dictionary are described in File Attribute Keys. (see NSFile* shared methods)

Special Considerations
This method does not traverse symbolic links. If the item at the path is a symbolic link—that is, the value of the NSFileType key in the attributes dictionary is NSFileTypeSymbolicLink—you can use the destinationOfSymbolicLinkAtPath method to retrieve the path of the item pointed to by the link. You can also use the stringByResolvingSymlinksInPath method of NSString to resolve links in the path before retrieving the item's attributes.

Available in Mac OS X v10.5 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.changeCurrentDirectory(folder as folderitem) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Changes the path of the current working directory to the specified path.
Example:
dim m as new NSFileManagerMBS
dim f as FolderItem = SpecialFolder.Applications
if m.changeCurrentDirectory(f) then
MsgBox m.currentDirectory.AbsolutePath
end if
Notes:
folder: The path of the directory to which to change.

Returns true if successful, otherwise false.

All relative pathnames refer implicitly to the current working directory. Changing the current working directory affects only paths created in the current process.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.changeCurrentDirectory(path as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Changes the path of the current working directory to the specified path.
Example:
dim m as new NSFileManagerMBS
if m.changeCurrentDirectory("/Users") then
MsgBox m.currentDirectoryPath
end if
Notes:
path: The path of the directory to which to change.

Returns true if successful, otherwise false.

All relative pathnames refer implicitly to the current working directory. Changing the current working directory affects only paths created in the current process.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.containerFolderForSecurityApplicationGroupIdentifier(groupIdentifier as string) as folderItem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 14.3 Yes No No Yes, macOS only No
Function: Returns the container directory associated with the specified security application group ID.
Notes:
As explained in App Sandbox Design Guide, groups of sandboxed apps that need to share files and other information can request a container directory as part of their entitlements. These directories are stored in ~/Library/Group Containers/.

When called with a valid group identifier, this method returns the location of that directory as an folderitem. This method also creates the directory if it does not yet exist.

Important: Your app must have a com.apple.security.application-groups entitlement for the specified application group.

Available in OS X v10.8 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.containerURLForSecurityApplicationGroupIdentifier(groupIdentifier as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 14.3 Yes No No Yes, macOS only No
Function: Returns the container directory associated with the specified security application group ID.
Notes:
As explained in App Sandbox Design Guide, groups of sandboxed apps that need to share files and other information can request a container directory as part of their entitlements. These directories are stored in ~/Library/Group Containers/.

When called with a valid group identifier, this method returns the location of that directory as an URL. This method also creates the directory if it does not yet exist.

Important: Your app must have a com.apple.security.application-groups entitlement for the specified application group.

Available in OS X v10.8 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.copyItem(source as folderItem, dest as folderItem, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 13.4 Yes No No Yes, macOS only No
Function: Copies the item at the specified path to a new location synchronously.
Notes:
Source: The path to the file or directory you want to move.
Dest: The path at which to place the copy of srcPath. This path must include the name of the file or directory in its new location.
error: If an error occurs, this is set to an actual error object containing the error information.

Returns true if the item was copied successfully or the file manager's delegate aborted the operation deliberately. Returns false if an error occurred.

When copying items, the current process must have permission to read the file or directory at Source and write the parent directory of Dest. If the item at Source is a directory, this method copies the directory and all of its contents, including any hidden files. If a file with the same name already exists at Dest, this method aborts the copy attempt and returns an appropriate error. If the last component of srcPath is a symbolic link, only the link is copied to the new path.

Available in OS X v10.5 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.copyItemMT(source as folderItem, dest as folderItem, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 18.2 Yes No No Yes, macOS only No
Function: Copies the item at the specified path to a new location synchronously.
Example:
dim f as FolderItem = SpecialFolder.Desktop.Child("test.rtf")
dim d as FolderItem = SpecialFolder.Desktop.Child("output.rtf")
dim e as NSErrorMBS

if not NSFileManagerMBS.copyItemMT(f,d,e) then
MsgBox e.LocalizedDescription
else
MsgBox "OK"
end if
Notes:
Must be called inside a Xojo (Real Studio) thread so time yields to main thread and you can keep the GUI running.

Source: The path to the file or directory you want to move.
Dest: The path at which to place the copy of srcPath. This path must include the name of the file or directory in its new location.
error: If an error occurs, this is set to an actual error object containing the error information.

Returns true if the item was copied successfully or the file manager's delegate aborted the operation deliberately. Returns false if an error occurred.

When copying items, the current process must have permission to read the file or directory at Source and write the parent directory of Dest. If the item at Source is a directory, this method copies the directory and all of its contents, including any hidden files. If a file with the same name already exists at Dest, this method aborts the copy attempt and returns an appropriate error. If the last component of srcPath is a symbolic link, only the link is copied to the new path.

Available in OS X v10.5 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.createSymbolicLink(file as folderitem, destFile as folderitem, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Creates a symbolic link at the specified URL that points to an item at the given URL.
Example:
dim m as new NSFileManagerMBS
dim file as FolderItem = SpecialFolder.Desktop.Child("test.rtf")
dim destfile as FolderItem = SpecialFolder.Desktop.Child("Notes.rtf")
dim error as NSErrorMBS

if m.createSymbolicLink(file, destfile, error) then
MsgBox "OK"
else
MsgBox "Error: "+error.localizedDescription
end if
Notes:
file: The path at which to create the new symbolic link. The last path component is used as the name of the link.
destFile: The path that contains the item to be pointed to by the link. In other words, this is the destination of the link.
error: If an error occurs, upon return contains an NSError object that describes the problem.

Returns true if the symbolic link was created or false if an error occurred. This method also returns false if a file, directory, or link already exists at path.

This method does not traverse symbolic links contained in either path or destPath.

Available in Mac OS X v10.5 and later.
As of Mac OS X 10.7 tests here, it seems like an alias file is created, not a symbolic link.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.createSymbolicLink(path as string, destPath as string, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Creates a symbolic link that points to the specified destination.
Notes:
path: The path at which to create the new symbolic link. The last path component is used as the name of the link.
destPath: The path that contains the item to be pointed to by the link. In other words, this is the destination of the link.
error: If an error occurs, upon return contains an NSError object that describes the problem.

Returns true if the symbolic link was created or false if an error occurred. This method also returns false if a file, directory, or link already exists at path.

This method does not traverse symbolic links contained in either path or destPath.

Available in Mac OS X v10.5 and later.
As of Mac OS X 10.7 tests here, it seems like an alias file is created, not a symbolic link.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.currentDirectory as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns the path of the program's current directory.
Example:
dim m as new NSFileManagerMBS
dim f as FolderItem = SpecialFolder.Applications
if m.changeCurrentDirectory(f) then
MsgBox m.currentDirectory.AbsolutePath
end if
Notes:
Returns the path of the program's current directory. If the program's current working directory isn't accessible, returns nil.

The string returned by this method is initialized to the current working directory; you can change the working directory by invoking changeCurrentDirectoryPath.

Relative pathnames refer implicitly to the current directory. For example, if the current directory is /tmp, and the relative pathname reports/info.txt is specified, the resulting full pathname is /tmp/reports/info.txt.

Feedback, Comments & Corrections

NSFileManagerMBS.currentDirectoryPath as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns the path of the program's current directory as string.
Example:
dim m as new NSFileManagerMBS
MsgBox m.currentDirectoryPath
Notes:
Returns the path of the program's current directory. If the program's current working directory isn't accessible, returns "".

The string returned by this method is initialized to the current working directory; you can change the working directory by invoking changeCurrentDirectoryPath.

Relative pathnames refer implicitly to the current directory. For example, if the current directory is /tmp, and the relative pathname reports/info.txt is specified, the resulting full pathname is /tmp/reports/info.txt.

Feedback, Comments & Corrections

NSFileManagerMBS.destinationOfSymbolicLinkAtPath(file as folderitem, byref error as NSErrorMBS) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 16.5 Yes No No Yes, macOS only No
Function: Returns the path of the item pointed to by a symbolic link.
Notes:
file: The folderitem of a file or directory. Be aware that Xojo may already have resolved the symlink!
error: If an error occurs, upon return contains an NSError object that describes the problem.

Returns a string containing the path of the directory or file to which the symbolic link path refers, or "" upon failure. If the symbolic link is specified as a relative path, that relative path is returned.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.destinationOfSymbolicLinkAtPath(path as string, byref error as NSErrorMBS) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 16.5 Yes No No Yes, macOS only No
Function: Returns the path of the item pointed to by a symbolic link.
Example:
dim f as new NSFileManagerMBS
dim e as NSErrorMBS

dim p as string = f.destinationOfSymbolicLinkAtPath("/tmp", e)

if e = nil then
MsgBox p
else
MsgBox e.LocalizedDescription
end if
Notes:
path: The path of a file or directory.
error: If an error occurs, upon return contains an NSError object that describes the problem.

Returns a string containing the path of the directory or file to which the symbolic link path refers, or "" upon failure. If the symbolic link is specified as a relative path, that relative path is returned.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.displayName(path as folderitem) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns the display name of the file or directory at a specified path.
Notes:
path: The path of a file or directory.

The name of the file or directory at path in a localized form appropriate for presentation to the user. If there is no file or directory at path, or if an error occurs, returns path as is.

Display names are user-friendly names for files. They are typically used to localize standard file and directory names according to the user's language settings. They may also reflect other modifications, such as the removal of filename extensions. Such modifications are used only when displaying the file or directory to the user and do not reflect the actual path to the item in the file system. For example, if the current user's preferred language is French, the following code fragment logs the name Bibliothèque and not the name Library, which is the actual name of the directory.

Feedback, Comments & Corrections

NSFileManagerMBS.evictUbiquitousItem(item as folderitem, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Removes the local copy of the specified cloud-based item.
Notes:
item: Specify the file or directory in iCloud storage.
error: If an error occurs, this pointer is set to an NSError object containing information about the error.

Returns true if the local item was removed successfully or false if it was not. If false is returned, an NSError object describing the error is returned in the error parameter.

This method does not remove the item from the cloud. It removes only the local version. You can use this method to force iCloud to download a new version of the file or directory from the server.

To delete a file permanently from the user's iCloud storage, use the regular NSFileManager routines for deleting files and directories. Remember that deleting items from iCloud cannot be undone. Once deleted, the item is gone forever.

Available in Mac OS X v10.7 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.fileExists(path as folderitem) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates whether a file or directory exists at a specified path.
Example:
dim m as new NSFileManagerMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("notes.rtf")

MsgBox "File exists: "+str(m.fileExists(f))
Notes:
path: The path of the file or directory. I

Returns true if a file at the specified path exists or false if the file's does not exist or its existence could not be determined.

If the file at path is inaccessible to your application, perhaps because one or more parent directories are inaccessible, this method returns false. If the final element in path specifies a symbolic link, this method traverses the link and returns true or false based on the existence of the file at the link destination.

Note: Attempting to predicate behavior based on the current state of the file system or a particular file on the file system is not recommended. Doing so can cause odd behavior or race conditions. It's far better to attempt an operation (such as loading a file or creating a directory), check for errors, and handle those errors gracefully than it is to try to figure out ahead of time whether the operation will succeed. For more information on file system race conditions, see Race Conditions, File Operations, and Interprocess Communication in Secure Coding Guide.
http://developer.apple.com/library/mac/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.fileExists(path as folderitem, byref isDirectory as boolean) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates whether a file or directory exists at a specified path.
Example:
dim m as new NSFileManagerMBS
dim f as FolderItem = SpecialFolder.Desktop

dim directory as Boolean
MsgBox "File exists: "+str(m.fileExists(f, directory))+" and is Directory: "+str(Directory)
Notes:
path: The path of a file or directory.
isDirectory: Upon return, contains true if path is a directory or if the final path element is a symbolic link that points to a directory, otherwise contains false. If path doesn't exist, the return value is undefined.

Returns true if a file at the specified path exists or false if the file's does not exist or its existence could not be determined.

If the file at path is inaccessible to your application, perhaps because one or more parent directories are inaccessible, this method returns false. If the final element in path specifies a symbolic link, this method traverses the link and returns true or false based on the existence of the file at the link destination.

If you need to further determine if path is a package, use the isFilePackageAtPath method of NSWorkspaceMBS.

Note: Attempting to predicate behavior based on the current state of the file system or a particular file on the file system is not recommended. Doing so can cause odd behavior or race conditions. It's far better to attempt an operation (such as loading a file or creating a directory), check for errors, and handle those errors gracefully than it is to try to figure out ahead of time whether the operation will succeed. For more information on file system race conditions, see Race Conditions, File Operations, and Interprocess Communication in Secure Coding Guide.
http://developer.apple.com/library/mac/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.FileForUbiquityContainerIdentifier(containerIdentifier as string) as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns the iCloud directory associated with the specified container ID.
Notes:
containerID: Specify the container ID of the cloud-based storage container. The string you specify must not contain wildcards and must be of the form <TEAMID>.<CONTAINER>, where <TEAMID> is your development team ID and <CONTAINER> describes the bundle identifier of the container you want to access. The container identifiers for your application must be declared in the com.apple.developer.ubiquity-container-identifiers entitlement.
If you specify "", this method returns the first container listed in the com.apple.developer.ubiquity-container-identifiers entitlement.

Returns a folderitem pointing to the specified container directory or nil if the container could not be located or if iCloud storage is unavailable for the current user or device.

You can use the folderitem returned by this method to build paths to files and directories in the user's iCloud storage. Each application that syncs documents to the cloud must have at least one associated container directory in which to put those files. This container directory can be unique to the application or shared by multiple applications. You use this method to retrieve the folderitem for that container directory.

In addition to writing to its own container directory, an application can write to any container directory for which it has the appropriate permission. Each additional container directory should be listed as an additional value in the com.apple.developer.ubiquity-container-identifiers entitlement.

Note: The development team ID that precedes each container ID string is the unique identifier associated with your development team. You can find this string in the Member Center of the Apple Developer website (http://developer.apple.com/membercenter). From the Member Center home page, select the Your Account tab and then select Organization Profile from the column on the left of that tab. Your team's identifier is in the Company/Organization ID field.
The first time you call this method for a given container directory, iOS extends your application sandbox to include that container directory. Thus, it is important that you call this method at least once before trying to search for files in iCloud. And if your application accesses multiple container directories, you should call the method once for each directory.

Available in Mac OS X v10.7 and later.
FileForUbiquityContainerIdentifier returns folderitem while URLForUbiquityContainerIdentifier returns URL string.

Feedback, Comments & Corrections

NSFileManagerMBS.isDeletableFile(path as folderitem) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates whether the invoking object appears able to delete a specified file.
Example:
dim m as new NSFileManagerMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("notes.rtf")

MsgBox "Can delete: "+str(m.isDeletableFile(f))
Notes:
path: A file path.

Returns true if the current process has delete privileges for the file at path; otherwise false if the process does not have delete privileges or the existence of the file could not be determined.

For a directory or file to be deletable, the current process must either be able to write to the parent directory of path or it must have the same owner as the item at path. If path is a directory, every item contained in path must be deletable by the current process.

If the file at path is inaccessible to your application, perhaps because it does not have search privileges for one or more parent directories, this method returns false. This method does not traverse symbolic links in the path.

Note: Attempting to predicate behavior based on the current state of the file system or a particular file on the file system is not recommended. Doing so can cause odd behavior or race conditions. It's far better to attempt an operation (such as loading a file or creating a directory), check for errors, and handle those errors gracefully than it is to try to figure out ahead of time whether the operation will succeed. For more information on file system race conditions, see Race Conditions, File Operations, and Interprocess Communication in Secure Coding Guide.
http://developer.apple.com/library/mac/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585

Feedback, Comments & Corrections

NSFileManagerMBS.isExecutableFile(path as folderitem) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates whether the operating system appears able to execute a specified file.
Example:
dim m as new NSFileManagerMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("notes.rtf")

MsgBox "Can execute: "+str(m.isExecutableFile(f))
Notes:
path: A file path.

Returns true if the current process has execute privileges for the file at path; otherwise false if the process does not have execute privileges or the existence of the file could not be determined.

If the file at path is inaccessible to your application, perhaps because it does not have search privileges for one or more parent directories, this method returns false. This method traverses symbolic links in the path. This method also uses the real user ID and group ID, as opposed to the effective user and group IDs, to determine if the file is executable.

Note: Attempting to predicate behavior based on the current state of the file system or a particular file on the file system is not recommended. Doing so can cause odd behavior or race conditions. It's far better to attempt an operation (such as loading a file or creating a directory), check for errors, and handle those errors gracefully than it is to try to figure out ahead of time whether the operation will succeed. For more information on file system race conditions, see Race Conditions, File Operations, and Interprocess Communication in Secure Coding Guide:
http://developer.apple.com/library/mac/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585

Feedback, Comments & Corrections

NSFileManagerMBS.isReadableFile(path as folderitem) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates whether the invoking object appears able to read a specified file.
Example:
dim m as new NSFileManagerMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("notes.rtf")

MsgBox "Can read: "+str(m.isReadableFile(f))
Notes:
path: A file path.

Returns true if the current process has read privileges for the file at path; otherwise false if the process does not have read privileges or the existence of the file could not be determined.

If the file at path is inaccessible to your application, perhaps because it does not have search privileges for one or more parent directories, this method returns false. This method traverses symbolic links in the path. This method also uses the real user ID and group ID, as opposed to the effective user and group IDs, to determine if the file is readable.

Note: Attempting to predicate behavior based on the current state of the file system or a particular file on the file system is not recommended. Doing so can cause odd behavior or race conditions. It's far better to attempt an operation (such as loading a file or creating a directory), check for errors, and handle those errors gracefully than it is to try to figure out ahead of time whether the operation will succeed. For more information on file system race conditions, see Race Conditions, File Operations, and Interprocess Communication in Secure Coding Guide.
http://developer.apple.com/library/mac/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585

Feedback, Comments & Corrections

NSFileManagerMBS.isUbiquitousItem(item as folderitem) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns a Boolean indicating whether the item is targeted for storage in iCloud.
Example:
dim m as new NSFileManagerMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("notes.rtf")

MsgBox "Is in iCloud: "+str(m.isUbiquitousItem(f))
Notes:
item: Specify the folderitem for the file or directory whose status you want to check.

Returns true if the item is targeted for iCloud storage or false if it is not. This method also returns false if no item exists at url.

This method reflects only whether the item should be stored in iCloud because a call was made to the setUbiquitous method with a value of true for its flag parameter. This method does not reflect whether the file has actually been uploaded to any iCloud servers. To determine a file's upload status, check the IsUploadedMBS function in the folderitem class.

Available in Mac OS X v10.7 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.isUbiquitousItem(URL as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns a Boolean indicating whether the item is targeted for storage in iCloud.
Notes:
item: Specify the URL for the file or directory whose status you want to check.

Returns true if the item is targeted for iCloud storage or false if it is not. This method also returns false if no item exists at url.

This method reflects only whether the item should be stored in iCloud because a call was made to the setUbiquitous method with a value of true for its flag parameter. This method does not reflect whether the file has actually been uploaded to any iCloud servers. To determine a file's upload status, check the IsUploadedMBS function in the folderitem class.

Available in Mac OS X v10.7 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.isWritableFile(path as folderitem) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns a Boolean value that indicates whether the invoking object appears able to write to a specified file.
Example:
dim m as new NSFileManagerMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("notes.rtf")

MsgBox "Can write: "+str(m.isWritableFile(f))
Notes:
path: A file path.

Returns true if the current process has write privileges for the file at path; otherwise false if the process does not have write privileges or the existence of the file could not be determined.

If the file at path is inaccessible to your application, perhaps because it does not have search privileges for one or more parent directories, this method returns false. This method traverses symbolic links in the path. This method also uses the real user ID and group ID, as opposed to the effective user and group IDs, to determine if the file is writable.

Note: Attempting to predicate behavior based on the current state of the file system or a particular file on the file system is not recommended. Doing so can cause odd behavior or race conditions. It's far better to attempt an operation (such as loading a file or creating a directory), check for errors, and handle those errors gracefully than it is to try to figure out ahead of time whether the operation will succeed. For more information on file system race conditions, see Race Conditions, File Operations, and Interprocess Communication in Secure Coding Guide:
http://developer.apple.com/library/mac/documentation/Security/Conceptual/SecureCodingGuide/Articles/RaceConditions.html#//apple_ref/doc/uid/TP40002585

Feedback, Comments & Corrections

NSFileManagerMBS.lastPathComponent(pathOrURL as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns the last path component of a file URL or file path.
Notes: Available in Mac OS X v10.6 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.linkItem(source as folderItem, dest as folderItem, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 13.4 Yes No No Yes, macOS only No
Function: Creates a hard link between the items at the specified paths.
Notes:
Source: The path that specifies the item you wish to link to. The value in this parameter must not be nil.
Dest: The path that identifies the location where the link will be created. The value in this parameter must not be nil.
error: If an error occurs, this pointer is set to an actual error object containing the error information.

Returns true if the hard link was created or NO if an error occurred. This method also returns false if a file, directory, or link already exists at dstPath.

Use this method to create hard links between files in the current file system. If Source is a directory, this method creates a new directory at Dest and then creates hard links for the items in that directory. If Source is (or contains) a symbolic link, the symbolic link is copied to the new location and not converted to a hard link.

Available in OS X v10.5 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.moveItem(source as folderItem, dest as folderItem, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 13.4 Yes No No Yes, macOS only No
Function: Moves the file or directory at the specified path to a new location synchronously.
Notes:
source: The path to the file or directory you want to move. This parameter must not be nil.
dest: The new path for the item in Source. This path must include the name of the file or directory in its new location. This parameter must not be nil.
error: If an error occurs, this is set to an actual error object containing the error information.

Returns true if the item was moved successfully or the file manager's delegate aborted the operation deliberately. Returns NO if an error occurred.

When moving items, the current process must have permission to read the item at Source and write the parent directory of Dest. If the item at Source is a directory, this method moves the directory and all of its contents, including any hidden files. If an item with the same name already exists at Dest, this method aborts the move attempt and returns an appropriate error. If the last component of Source is a symbolic link, only the link is moved to the new path; the item pointed to by the link remains at its current location.

If the source and destination of the move operation are not on the same volume, this method copies the item first and then removes it from its current location. This behavior may trigger additional delegate notifications related to copying and removing individual items.

Available in OS X v10.5 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.NSFileAppendOnly as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.3 Yes No No Yes, macOS only No
Function: One of the keys to access file attribute values contained in dictionary used by setAttributes, attributesOfItemAtPath, createDirectoryAtPath, and createFileAtPath.
Notes:
The key in a file attribute dictionary whose value indicates whether the file is read-only.
The corresponding value is a number containing a Boolean value.
Available in Mac OS X v10.2 and later.

Feedback, Comments & Corrections

Next items

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




Links
MBS FileMaker Plugins