I am trying to use FileManager contentsOfDirectory(at:,includingPropertiesForKeys:,options:) to get the contents of the root level of an AFP mounted volume. The call throws an exception. Volume is mounted and readily accessible in Finder.
The url content is "file:///Volumes/incoming/"
The error received is The file “incoming” couldn’t be opened because you don’t have permission to view it.
Here is the relevant code:
do {
let contents = try FileManager.default.contentsOfDirectory(at: url, includingPropertiesForKeys: nil, options: [.skipsHiddenFiles,.skipsPackageDescendants,.skipsSubdirectoryDescendants])
result = contents
}
catch let error as NSError {
print(error.localizedDescription)
}
Is there something else I need to be doing? I have not done MacOS dev for a while so I am guessing I am missing something simple. Some setting in the info.plist required now or something along those lines?