_nativePathString(escaped:)
Returns the File System Representation of the AbsolutePath
’s pathString
property converted into a URL
.
func _nativePathString(escaped: Bool) -> String
Returns the File System Representation of the AbsolutePath
’s pathString
property converted into a URL
.
func _nativePathString(escaped: Bool) -> String
s6Basics12AbsolutePathV07_nativeC6String7escapedSSSb_tF
What are these?5H8GH
import Basics
struct AbsolutePath
Represents an absolute file system path, independently of what (or whether anything at all) exists at that path in the file system at any given time. An absolute path always starts with a /
character, and holds a normalized string representation. This normalization is strictly syntactic, and does not access the file system in any way.
@frozen struct Bool
A value type whose instances are either true
or false
.
@frozen struct String
A Unicode string value that is a collection of characters.
init(_ underlying: TSCAbsolutePath)
init(_ absolutePath: AbsolutePath, _ relativeTo: RelativePath)
Initializes the AbsolutePath by concatenating a relative path to an existing absolute path, and renormalizing if necessary.
init(_ absolutePath: AbsolutePath, validating relativePathString: String) throws
Convenience initializer that appends a string to a relative path.
init(from decoder: Decoder) throws
init(validating pathString: 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 pathString: 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 allExtensions: [String]? { get }
Unlike AbsolutePath//extension
, this property returns all characters after the first .
character in a filename. If no dot character is present in the filename or first dot is the last character, nil
is returned.
var asURL: Foundation.URL { get }
var basename: String { get }
Last path component (including the suffix, if any). it is never empty.
var basenameWithoutAnyExtension: String { get }
Returns the basename dropping any possible extension.
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 escapedPathString: String { get }
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(_ component: String) -> AbsolutePath
Returns the absolute path with additional literal components appended.
func appending(_ components: String...) -> AbsolutePath
Returns the absolute path with additional literal components appended.
func appending(_ relativePath: 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: String...) -> AbsolutePath
Returns the absolute path with additional literal components appended.
func appending(components: [String]) -> AbsolutePath
Returns the absolute path with additional literal components appended.
func appending(extension: String) -> AbsolutePath
Returns the absolute path with additional extension 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? = localFileSystem.currentWorkingDirectory) -> 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.