On May 28, 2010, at 10:01 AM, Tito Ciuro wrote:

> The old statement traverses the link:
> 
>       NSDictionary* attr = [[NSFileManager defaultManager] 
> fileAttributesAtPath:file traverseLink:YES];
> 
> The problem is that the header states that 'attributesOfItemAtPath:error:' 
> that it's a replacement for 'fileAttributesAtPath:traverseLink:', but 
> provides no provision for traversing the link.
> 
> How would I obtain the attributes of an item that needs to be traversed first?

You can easily traverse a link just by using [file 
stringByResolvingSymlinksInPath] or [file stringByStandardizingPath] instead of 
file. Where this gets tricky is if you *don’t* want to resolve the symlink. 
Currently, the method doesn’t traverse symbolic links, but the documentation 
claims that this behavior could change in a future version of OS X, so if you 
need to guarantee that it won’t resolve, the only options are either to use 
deprecated methods, or to use Carbon or BSD APIs.

Charles_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to