Skip to content

Commit 1f56e95

Browse files
committed
fix cross platform build issue
1 parent 95e05db commit 1f56e95

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

Sources/Foundation/FileManager+POSIX.swift

+14-4
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,13 @@ extension FileManager {
803803
let ps = UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>.allocate(capacity: 2)
804804
ps.initialize(to: UnsafeMutablePointer(mutating: fsRep))
805805
ps.advanced(by: 1).initialize(to: nil)
806-
let stream = ps.withMemoryRebound(to: UnsafeMutablePointer<CChar>.self, capacity: 2) {
807-
fts_open($0, FTS_PHYSICAL | FTS_XDEV | FTS_NOCHDIR | FTS_NOSTAT, nil)
806+
let stream = ps.withMemoryRebound(to: UnsafeMutablePointer<CChar>.self, capacity: 2) { rebound_ps in
807+
#if canImport(Android)
808+
let arg = rebound_ps
809+
#else
810+
let arg = ps
811+
#endif
812+
return fts_open(arg, FTS_PHYSICAL | FTS_XDEV | FTS_NOCHDIR | FTS_NOSTAT, nil)
808813
}
809814
ps.deinitialize(count: 2)
810815
ps.deallocate()
@@ -1173,8 +1178,13 @@ extension FileManager {
11731178
defer { ps.deallocate() }
11741179
ps.initialize(to: UnsafeMutablePointer(mutating: fsRep))
11751180
ps.advanced(by: 1).initialize(to: nil)
1176-
return ps.withMemoryRebound(to: UnsafeMutablePointer<CChar>.self, capacity: 2) {
1177-
fts_open($0, FTS_PHYSICAL | FTS_XDEV | FTS_NOCHDIR | FTS_NOSTAT, nil)
1181+
return ps.withMemoryRebound(to: UnsafeMutablePointer<CChar>.self, capacity: 2) { rebound_ps in
1182+
#if canImport(Android)
1183+
let arg = rebound_ps
1184+
#else
1185+
let arg = ps
1186+
#endif
1187+
return fts_open(arg, FTS_PHYSICAL | FTS_XDEV | FTS_NOCHDIR | FTS_NOSTAT, nil)
11781188
}
11791189
}
11801190
if _stream == nil {

0 commit comments

Comments
 (0)