This commit is contained in:
Max Howell
2019-01-17 16:33:38 -05:00
parent 8e0d766924
commit 97e9cbaa8f
16 changed files with 754 additions and 0 deletions

21
Sources/Path->Bool.swift Normal file
View File

@@ -0,0 +1,21 @@
import Foundation
public extension Path {
var isWritable: Bool {
return FileManager.default.isWritableFile(atPath: string)
}
var isDirectory: Bool {
var isDir: ObjCBool = false
return FileManager.default.fileExists(atPath: string, isDirectory: &isDir) && isDir.boolValue
}
var isFile: Bool {
var isDir: ObjCBool = true
return FileManager.default.fileExists(atPath: string, isDirectory: &isDir) && !isDir.boolValue
}
var exists: Bool {
return FileManager.default.fileExists(atPath: string)
}
}