Skip to content

Commit b99a449

Browse files
committed
fix the fts_open call for Android nullability so that it works on other platforms correctly
1 parent c1dbcb8 commit b99a449

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/FoundationEssentials/FileManager/FileOperations+Enumeration.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,12 @@ struct _FTSSequence: Sequence {
167167
}
168168

169169
state = [Optional(UnsafeMutablePointer(mutating: path)), nil].withUnsafeBufferPointer { dirList in
170-
guard let stream = fts_open(unsafeBitCast(dirList.baseAddress!, to: UnsafePointer<UnsafeMutablePointer<CChar>>.self), opts, nil) else {
170+
#if canImport(Android)
171+
let baseAddress = unsafeBitCast(dirList.baseAddress!, to: UnsafePointer<UnsafeMutablePointer<CChar>>.self)
172+
#else
173+
let baseAddress = dirList.baseAddress!
174+
#endif
175+
guard let stream = fts_open(baseAddress, opts, nil) else {
171176
return .error(errno, String(cString: path))
172177
}
173178
return .stream(stream)

0 commit comments

Comments
 (0)