On May 10, 2014, at 15:17 , Charles Srstka <cocoa...@charlessoft.com> wrote:

> Since that's the case Quincey was talking about (greying out files that don't 
> exist in the UI), I'd say checkResourceIsReachableAndReturnError: is the 
> appropriate API to use. It's certainly more efficient than reading the file 
> just to see if it exists.

It might be the appropriate API, but its semantics are not entirely obvious. 
The documentation does not make clear what reachability means in the case of a 
file URL. Presumably, file systems are reachable if and only if they are 
mounted, but there’s surely a slight discomfort level with such an assumption. 
Maybe it’s just me.

Anyway, we weren’t suggesting reading the file just to see if it exists. We 
were suggesting reading the file if you’re going to read the file anyway. If 
you’re checking for existence, I think -[NSURL getResourceValue:forKey:error:] 
and -[NSURL resourcesValuesForKeys:error:] are good patterns to keep in mind, 
because in many cases you actually *do* want to know one or more resource 
values. For example, you might at least want to know whether the item is a file 
or a directory.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to