Skip to content

Commit c23baa8

Browse files
committed
Fixed Swift 3 and macOS compilation
1 parent d83af64 commit c23baa8

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Tests/ZIPFoundationTests/ZIPFoundationFileManagerTests.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ extension ZIPFoundationTests {
407407
#if swift(>=4.0)
408408
#elseif swift(>=3.0)
409409
internal extension FileManager {
410-
410+
411+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
411412
@objc(swiftCreateFileAtPath:contents:attributes:)
412413
@discardableResult
413414
func createFile(atPath path: String,
@@ -419,6 +420,18 @@ internal extension FileManager {
419420
}
420421
return createFile(atPath: path, contents: contents, attributes: attributes)
421422
}
423+
#else
424+
@discardableResult
425+
func createFile(atPath path: String,
426+
contents: Data? = nil,
427+
attributes swift4Attributes: [FileAttributeKey: Any]) -> Bool {
428+
var attributes = [String: Any](minimumCapacity: swift4Attributes.count)
429+
swift4Attributes.forEach {
430+
attributes[$0.key.rawValue] = $0.value
431+
}
432+
return createFile(atPath: path, contents: contents, attributes: attributes)
433+
}
434+
#endif
422435

423436
/**
424437
Not Implemented in swift-corelibs-foundation for Swift 3

0 commit comments

Comments
 (0)