Instance Method

isWritableFile(atPath:)

Returns a Boolean value that indicates whether the invoking object appears able to write to a specified file.

Declaration

func isWritableFile(atPath path: String) -> Bool

Parameters

path

A file path.

Return Value

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.

Discussion

If the file at path is inaccessible to your app, 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.

See Also

Determining Access to Files

func fileExists(atPath: String) -> Bool

Returns a Boolean value that indicates whether a file or directory exists at a specified path.

func fileExists(atPath: String, isDirectory: UnsafeMutablePointer<ObjCBool>?) -> Bool

Returns a Boolean value that indicates whether a file or directory exists at a specified path.

func isReadableFile(atPath: String) -> Bool

Returns a Boolean value that indicates whether the invoking object appears able to read a specified file.

func isExecutableFile(atPath: String) -> Bool

Returns a Boolean value that indicates whether the operating system appears able to execute a specified file.

func isDeletableFile(atPath: String) -> Bool

Returns a Boolean value that indicates whether the invoking object appears able to delete a specified file.