AbsolutePath
Path.swift:12struct AbsolutePath
struct AbsolutePath
import Path
protocol Comparable : Equatable
A type that can be compared using the relational operators <
, <=
, >=
, and >
.
protocol Copyable
A type whose values can be implicitly or explicitly copied.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Escapable
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
init(_ absPath: AbsolutePath, _ relPath: RelativePath)
Initializes the AbsolutePath by concatenating a relative path to an existing absolute path, and renormalizing if necessary.
init(_ absPath: AbsolutePath, validating relStr: String) throws
Convenience initializer that appends a string to a relative path.
init(from decoder: Decoder) throws
init(validating path: String) throws
Initializes the AbsolutePath from absStr
, which must be an absolute path (i.e. it must begin with a path separator; this initializer does not interpret leading ~
characters as home directory specifiers). The input string will be normalized if needed, as described in the documentation for AbsolutePath.
init(validating str: String, relativeTo basePath: AbsolutePath) throws
Initializes an AbsolutePath from a string that may be either absolute or relative; if relative, basePath
is used as the anchor; if absolute, it is used as is, and in this case basePath
is ignored.
static let root: AbsolutePath
Root directory (whose string representation is just a path separator).
var basename: String { get }
Last path component (including the suffix, if any). it is never empty.
var basenameWithoutExt: String { get }
Returns the basename without the extension.
var components: [String] { get }
Returns an array of strings that make up the path components of the absolute path. This is the same sequence of strings as the basenames of each successive path component, starting from the root. Therefore the first path component of an absolute path is always /
.
var debugDescription: String { get }
var description: String { get }
var dirname: String { get }
Directory component. An absolute path always has a non-empty directory component (the directory component of the root path is the root itself).
var `extension`: String? { get }
Extension of the give path’s basename. This follow same rules as suffix except that it doesn’t include leading .
character.
var isRoot: Bool { get }
True if the path is the root directory.
var parentDirectory: AbsolutePath { get }
Absolute path of parent directory. This always returns a path, because every directory has a parent (the parent directory of the root directory is considered to be the root directory itself).
var pathString: String { get }
Normalized string representation (the normalization rules are described in the documentation of the initializer). This string is never empty.
var suffix: String? { get }
Suffix (including leading .
character) if any. Note that a basename that starts with a .
character is not considered a suffix, nor is a trailing .
character.
static func < (lhs: AbsolutePath, rhs: AbsolutePath) -> Bool
func appending(_ subpath: RelativePath) -> AbsolutePath
Returns the absolute path with the relative path applied.
func appending(component: String) -> AbsolutePath
Returns the absolute path with an additional literal component appended.
func appending(components names: String...) -> AbsolutePath
func appending(components names: [String]) -> AbsolutePath
Returns the absolute path with additional literal components appended.
func encode(to encoder: Encoder) throws
func isAncestor(of descendant: AbsolutePath) -> Bool
Returns true if the path is an ancestor of the given path.
func isAncestorOfOrEqual(to descendant: AbsolutePath) -> Bool
Returns true if the path is an ancestor of or equal to the given path.
func isDescendant(of ancestor: AbsolutePath) -> Bool
Returns true if the path is a descendant of the given path.
func isDescendantOfOrEqual(to ancestor: AbsolutePath) -> Bool
Returns true if the path is a descendant of or equal to the given path.
func prettyPath(cwd: AbsolutePath?) -> String
Returns a path suitable for display to the user (if possible, it is made to be relative to the current working directory).
func relative(to base: AbsolutePath) -> RelativePath
Returns a relative path that, when concatenated to base
, yields the callee path itself. If base
is not an ancestor of the callee, the returned path will begin with one or more ..
path components.
init(_ absStr: String)
init(_ absPath: AbsolutePath, _ relStr: String)
init(_ str: String, relativeTo basePath: AbsolutePath)
func contains(_ other: AbsolutePath) -> Bool
Returns true if the path contains the given path.
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
static func ... (minimum: Self) -> PartialRangeFrom<Self>
Returns a partial range extending upward from a lower bound.
static func ... (maximum: Self) -> PartialRangeThrough<Self>
Returns a partial range up to, and including, its upper bound.
static func ... (minimum: Self, maximum: Self) -> ClosedRange<Self>
Returns a closed range that contains both of its bounds.
static func ..< (maximum: Self) -> PartialRangeUpTo<Self>
Returns a partial range up to, but not including, its upper bound.
static func ..< (minimum: Self, maximum: Self) -> Range<Self>
Returns a half-open range that contains its lower bound but not its upper bound.
static func <= (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func > (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func >= (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.