From cd19c306f6374cc1802d6a912dd010731ec503b5 Mon Sep 17 00:00:00 2001 From: Kim Topley Date: Fri, 17 Mar 2017 14:00:06 -0700 Subject: [PATCH] Makes the DispatchIO initializer that accepts a path failable, reflecting the fact that a relative or non-existent path is invalid. (Radar 31115994) --- src/swift/IO.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/swift/IO.swift b/src/swift/IO.swift index 8ce417aa7..d26f64160 100644 --- a/src/swift/IO.swift +++ b/src/swift/IO.swift @@ -55,6 +55,7 @@ public extension DispatchIO { self.init(__type: type.rawValue, fd: fileDescriptor, queue: queue, handler: cleanupHandler) } + @available(swift, obsoleted: 4) public convenience init( type: StreamType, path: UnsafePointer, @@ -66,6 +67,18 @@ public extension DispatchIO { self.init(__type: type.rawValue, path: path, oflag: oflag, mode: mode, queue: queue, handler: cleanupHandler) } + @available(swift, introduced: 4) + public convenience init?( + type: StreamType, + path: UnsafePointer, + oflag: Int32, + mode: mode_t, + queue: DispatchQueue, + cleanupHandler: @escaping (_ error: Int32) -> Void) + { + self.init(__type: type.rawValue, path: path, oflag: oflag, mode: mode, queue: queue, handler: cleanupHandler) + } + public convenience init( type: StreamType, io: DispatchIO,