From c23baa8a759996ffd02e896e1e60de7354ead5fe Mon Sep 17 00:00:00 2001 From: Alsey Coleman Miller Date: Fri, 14 Sep 2018 23:59:00 -0500 Subject: [PATCH] Fixed Swift 3 and macOS compilation --- .../ZIPFoundationFileManagerTests.swift | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Tests/ZIPFoundationTests/ZIPFoundationFileManagerTests.swift b/Tests/ZIPFoundationTests/ZIPFoundationFileManagerTests.swift index 6c0fe80a..38b8a3ca 100644 --- a/Tests/ZIPFoundationTests/ZIPFoundationFileManagerTests.swift +++ b/Tests/ZIPFoundationTests/ZIPFoundationFileManagerTests.swift @@ -407,7 +407,8 @@ extension ZIPFoundationTests { #if swift(>=4.0) #elseif swift(>=3.0) internal extension FileManager { - + + #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) @objc(swiftCreateFileAtPath:contents:attributes:) @discardableResult func createFile(atPath path: String, @@ -419,6 +420,18 @@ internal extension FileManager { } return createFile(atPath: path, contents: contents, attributes: attributes) } + #else + @discardableResult + func createFile(atPath path: String, + contents: Data? = nil, + attributes swift4Attributes: [FileAttributeKey: Any]) -> Bool { + var attributes = [String: Any](minimumCapacity: swift4Attributes.count) + swift4Attributes.forEach { + attributes[$0.key.rawValue] = $0.value + } + return createFile(atPath: path, contents: contents, attributes: attributes) + } + #endif /** Not Implemented in swift-corelibs-foundation for Swift 3