STRUCT
Path
Contents
- Properties
type
pathString
callerPath
- Methods
path(_:)
relativeToCurrentFile(_:callerPath:)
relativeToManifest(_:)
relativeToRoot(_:)
init(stringLiteral:)
public struct Path: ExpressibleByStringInterpolation, Codable, Hashable, Sendable
A path represents to a file, directory, or a group of files represented by a glob expression.
Paths can be relative and absolute. We discourage using absolute paths because they create a dependency with the environment where they are defined.
Properties
type
public var type: PathType
pathString
public var pathString: String
callerPath
public var callerPath: String?
Methods
path(_:)
public static func path(_ path: String) -> Self
Default PathType is .relativeToManifest
relativeToCurrentFile(_:callerPath:)
public static func relativeToCurrentFile(_ pathString: String, callerPath: StaticString = #file) -> Path
Initialize a path that is relative to the file that defines the path.
relativeToManifest(_:)
public static func relativeToManifest(_ pathString: String) -> Path
Initialize a path that is relative to the directory that contains the manifest file being loaded, for example the directory that contains the Project.swift file.
relativeToRoot(_:)
public static func relativeToRoot(_ pathString: String) -> Path
Initialize a path that is relative to the closest directory that contains a Tuist or a .git directory.
init(stringLiteral:)
public init(stringLiteral: String)
Initializer uses .relativeToRoot
if path starts with //
otherwise it is .relativeToManifest
by default