Slide 13
Slide 13 text
Directory / File
#if os(Linux)
import Glibc
#else
import Darwin
#endif
#if os(Linux)
public func isAccessible(name: String) -> Bool {
guard !name.isEmpty else { return false }
return access(name, F_OK) == 0
}
#else
public func isAccessible(path: String) -> Bool {
guard !path.isEmpty else { return false }
return access(path, F_OK) == 0
}
#endif
13