Some documentation improvements

This commit is contained in:
Max Howell
2019-02-01 16:42:01 +00:00
parent 14963e48f5
commit 8248354a80
2 changed files with 11 additions and 7 deletions

View File

@@ -46,7 +46,8 @@ public extension Path {
// Create ~/.local/bin, copy `ls` there and make the new copy executable
try Path.root.join("bin/ls").copy(into: Path.home.join(".local/bin").mkdir(.p)).chmod(0o500)
If the destination does not exist, this function creates the directory first.
If the destination does not exist, this function creates the directory
(including intermediary directories if necessary) first.
- Parameter into: Destination directory
- Parameter overwrite: If true overwrites any file that already exists at `into`.
@@ -61,7 +62,7 @@ public extension Path {
@discardableResult
func copy(into: Path, overwrite: Bool = false) throws -> Path {
if !into.exists {
try FileManager.default.createDirectory(at: into.url, withIntermediateDirectories: true)
try into.mkdir(.p)
}
let rv = into/basename()
if overwrite, rv.isFile {
@@ -107,7 +108,8 @@ public extension Path {
try Path.root.join("bar").move(into: .home)
// => "/Users/mxcl/bar"
If the destination does not exist, this function creates the directory first.
If the destination does not exist, this function creates the directory
(including intermediary directories if necessary) first.
- Parameter into: Destination directory
- Parameter overwrite: If true *overwrites* any file that already exists at `into`.