Swiftpack.co - Package - BinaryBirds/path-kit

PathKit (💾)

Working with files and directories in a nice way using Swift.

Usage

Some examples:

import PathKit

let caches = Path.systemDirectory(for: .caches)
let home = Path.home
let parent = home.parent
let root = Path.root
let current = Path.current
let test = current.child("test")

print(test.isDirectory)
print(test.children().filter(\.isFile))

do {
    let work = try home.add("my-work-dir")
    print(work.location)

    try test.delete()
    try test.create()
    
    let a = current.child("a")
    try a.create()
    
    let b = current.child("b")
    let c = current.child("c")
    let d = current.child("d")

    try a.copy(to: b)
    try a.link(to: c)
    try a.move(to: d, force: true)
}
catch {
    print(error.localizedDescription)
}

Install

Just use the Swift Package Manager as usual:

.package(url: "https://github.com/binarybirds/path-kit", from: "1.0.0"),

Don't forget to add "PathKit" to your target as a dependency!

.product(name: "PathKit", package: "path-kit"),

That's it.

License

WTFPL - Do what the fuck you want to.

Github

link
Stars: 1

Dependencies

Used By

Total: 0

Releases

Project updates - 2020-10-03 13:47:30

  • Swift 5.3 support
  • New basename property
  • Name returns lastPathComponent
  • Removed unnecessary test files
  • Directory separator for Windows

- 2020-05-02 21:51:41

  • removed dynamic library

Fixed path location issue - 2020-04-20 15:02:09

First version - 2020-04-20 12:59:59