AnyPath

public struct AnyPath: Path

The path to a file system item of unknown type.

  • Creates an absolute path to an item from (but not including) the root folder through all the directories listed in the array. - Parameter components: The names of the directories in the path, ending with the item name. Each name must not be empty or contain only a ’.’, and any ’..’ must be at the beginning. Cannot be empty.

    Declaration

    Swift

    public init(absolute components: [String])

    Parameters

    components

    The names of the directories in the path, ending with the item name. Each name must not be empty or contain only a ‘.’, and any ‘..’ must be at the beginning. Cannot be empty.

  • Creates a relative path to an item, from the provided base. Each name in the parameter arrays must not be empty or contain only a ’.’, and any ’..’ must be at the beginning. - Parameter base: The names of the directories in the base, in order. - Parameter relative: The names of the directories in the relative part, ending with the item name. Cannot be empty.

    Declaration

    Swift

    public init(base: [String], relative: [String])

    Parameters

    base

    The names of the directories in the base, in order.

    relative

    The names of the directories in the relative part, ending with the item name. Cannot be empty.

  • The individual parts of the relative part (if any) of this path. Any ’..’ not at the beginning have been resolved, and there are no empty parts or only ’.’. If this exists, then so do baseComponents.

    Declaration

    Swift

    public var relativeComponents: [String]?
  • The individual parts of the base part (if any) of this path, from (but not including) the root folder. Any ’..’ not at the beginning have been resolved, and there are no empty parts or only ’.’. If this exists, then so do relativeComponents.

    Declaration

    Swift

    public var baseComponents: [String]?
  • The individual parts of the absolute version of this path, from (but not including) the root folder. Any ’..’ not at the beginning have been resolved, and there are no empty parts or only ’.’.

    Declaration

    Swift

    public var components: [String]
  • Creates a path from a string. If the string begins with a ’/’ it is absolute, otherwise it is relative to the current working directory.

    Declaration

    Swift

    public init(extendedGraphemeClusterLiteral value: String)
  • Creates a path from a string. If the string begins with a ’/’ it is absolute, otherwise it is relative to the current working directory.

    Declaration

    Swift

    public init(stringLiteral value: String)
  • Creates a path from a string. If the string begins with a ’/’ it is absolute, otherwise it is relative to the current working directory.

    Declaration

    Swift

    public init(unicodeScalarLiteral value: String)
  • Declaration

    Swift

    public static func == (left: AnyPath, right: AnyPath) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.