Effortless path operations in Swift.
let path = Path("/usr/bin/swift")
let path = Path("/usr/bin") + Path("swift")
path.isAbsolute
path.isRelative
path.exists()
path.isDirectory()
let absolutePath = path.absolute()
This cleans up any redundant ..
or .
and double slashes in paths.
let normalizedPath = path.normalize()
path.delete()
path.move(newPath)
Path.current
Path.current = "/usr/bin"
path.chdir {
// Path.current would be set to path during execution of this closure
}
path.children()
path.read()
path.write("Hello World!")
let paths = Path.glob("*.swift")
Kyle Fuller
PathKit is licensed under the BSD License.