swiftlang / swift-foundation

The Foundation project
Apache License 2.0
2.4k stars 160 forks source link

Availability of SwiftFileManager #909

Open sebsto opened 2 months ago

sebsto commented 2 months ago

This is a question, not an issue.

I noticed a new signature for function FileManager.fileExists : FileManager.fileExists(atPath path: String, isDirectory: inout Bool) -> Bool which is Swift-friendly and not use ObjCBool anymore.

But when I try to use is with the latest Swift 6 snaphot, it fails with

$ swift --version  
Apple Swift version 6.0-dev (LLVM c3efe9282719c35, Swift b163fed2b3101e0)
Target: arm64-apple-macosx14.0

$ swift build    

45 |             var isDirectory: Bool 
46 |             if FileManager.default.fileExists(atPath: localDepsPath, isDirectory: &isDirectory) {
   |                                                                                   |- error: cannot convert value of type 'UnsafeMutablePointer<Bool>' to expected argument type 'UnsafeMutablePointer<ObjCBool>'
   |                                                                                   `- note: arguments to generic parameter 'Pointee' ('Bool' and 'ObjCBool') are expected to be equal

How can we take advantage of this new function ?