Skip to content

Commit

Permalink
Fixed Swift 3 and macOS compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Sep 15, 2018
1 parent d83af64 commit c23baa8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Tests/ZIPFoundationTests/ZIPFoundationFileManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit c23baa8

Please sign in to comment.