Bump swift-actions/setup-swift from 1.22.0 to 1.23.0
Bumps swift-actions/setup-swift from 1.22.0 to 1.23.0.
updated-dependencies:
- dependency-name: swift-actions/setup-swift dependency-type: direct:production update-type: version-update:semver-minor …
Signed-off-by: dependabot[bot] support@github.com
PathWrangler
A simple path library written in Swift.
Installation
Add the following package dependency in your
Package.swift
:Or add it via Xcode (as of Xcode 11).
Usage
PathWrangler has two basic representations of a path:
AbsolutePath
andRelativePath
. They have everything you need for simple yet great path computations. A relative path (as the name suggests) is not bound to any root. It’s relative to whatever absolute path you need it to be. Thus it can also be turned into an absolute path usingabsolute(in:)
. An absolute path on the other hand is a path that always starts at the root.Both paths know how to “resolve” (or “simplify”) themselves. By doing so, they try to resolve and thus remove references of the current folder (
.
) and parent folder (..
). Since absolute paths know where to start, they are even able to resolve symlinks. To do so, however, the path must exist on disk. Both path implementations also have acurrent
accessor that returns the current path. ForAbsolutePath
this is thecwd
. ForRelativePath
this is always just the relative path to the current directory, thus.
.Path components or a relative path can be appended to both paths. There is even a convenience API that allows path building that almost looks like the path representation:
A protocol named
PathComponentConvertible
is used to represent path components. A bunch of default conformances (like forString
,Int
, etc.) make working with it easy. But adding more conformances is also easy. Just implement the only requirementpathComponent
and return the path component of the conforming type. As of then, the type can be used wherever path components are used in PathWrangler (like with the nice/
API mentioned before).The PathWrangler package contains two products:
CorePathWrangler
which contains all the underlying logic but has no dependency on Foundation whatsoever. It uses a few system APIs (likegetcwd
for determining the current working directory), but is otherwise mainly implemented in pure Swift using only stdlib types. It also depends on Swift Algorithms.PathWrangler
which adds a few neat APIs toFoundation
types likeFileManager
orURL
that make interacting withAbsolutePath
andRelativePath
easier.Documentation
The API is documented using header doc. If you prefer to view the documentation as a webpage, there is an online version available for you:
Contributing
If you find a bug / like to see a new feature in PathWrangler there are a few ways of helping out:
License
See LICENSE file.