Snow Leopard introduced many new methods for using NSURL objects to access files rather than path names or FSRefs of core services.
However, there is one task: I cannot find a method based on the URL for: Checking for a file. I am looking for the URL version - [NSFileManager fileExistsAtPath: ] . Like this method, it should return YES if the URL describes something, be it a regular file, directory, or something else.
I could try to find different resource values , but none of them explicitly guaranteed to exist if the file is missing, and some of them (like NSURLEffectiveIconKey ) can be expensive if that happens.
I could just use NSFileManager fileExistsAtPath: but if there is a more modern method, I would prefer to use it.
Is there an easy way or function in Cocoa, CF, or basic services that guarantee / document to tell me if a given file (or file link) refers to a file system object?
cocoa core-foundation osx-snow-leopard nsurl nsfilemanager
Peter Hosey Dec 18 '09 at 11:45 2009-12-18 11:45
source share