Skip to content

Commit

Permalink
Add FileManager.fileExists(atPath path: String, isDirectory: inout Bo…
Browse files Browse the repository at this point in the history
…ol) -> Bool
  • Loading branch information
Alkenso committed Nov 26, 2024
1 parent 149698f commit b247a19
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ extension FileManager {

/// Returns a Boolean value that indicates whether a file or directory exists at a specified url.
public func fileExists(at url: URL, isDirectory: inout Bool) -> Bool {
fileExists(atPath: url.path, isDirectory: &isDirectory)
}

/// Returns a Boolean value that indicates whether a file or directory exists at a specified path.
public func fileExists(atPath path: String, isDirectory: inout Bool) -> Bool {
var isDirectoryObjc = ObjCBool(false)
let exists = fileExists(atPath: url.path, isDirectory: &isDirectoryObjc)
let exists = fileExists(atPath: path, isDirectory: &isDirectoryObjc)
isDirectory = isDirectoryObjc.boolValue
return exists
}
Expand Down

0 comments on commit b247a19

Please sign in to comment.