FileManager

public final class FileManager

Class for interacting with the file system.

Only availible on Darwin (open has been marked as unavailible).

  • Determines whether a file descriptor exists at the specified path. Can be regular file, directory, socket, etc.

    Declaration

    Swift

    public static func itemExists(path: String) -> Bool
  • Determines whether a file exists at the specified path.

    Declaration

    Swift

    public static func fileExists(path: String) -> Bool
  • Determines whether a directory exists at the specified path.

    Declaration

    Swift

    public static func directoryExists(path: String) -> Bool
  • Attempts to change the current directory

    Declaration

    Swift

    public static func changeCurrentDirectory(newCurrentDirectory: String) throws
  • Gets the current directory

    Declaration

    Swift

    public static var currentDirectory: String
  • Reads the contents of a file.

    Declaration

    Swift

    public static func contents(path: String) throws -> Data
  • Sets the contents of an existing file.

    Declaration

    Swift

    public static func setContents(path: String, data: Data) throws