• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSFileManager 'attributesOfItemAtPath:error:' does not traverse a link?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSFileManager 'attributesOfItemAtPath:error:' does not traverse a link?


  • Subject: Re: NSFileManager 'attributesOfItemAtPath:error:' does not traverse a link?
  • From: Kevin Perry <email@hidden>
  • Date: Fri, 28 May 2010 08:33:17 -0700

That documentation is incorrect and is scheduled to be corrected. -attribtuesOfItemAtPath:error: will never automatically resolve symlinks, and that will never change.

-Kevin Perry

On May 28, 2010, at 8:17 AM, Charles Srstka wrote:

> 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 (email@hidden)
>
> 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:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >NSFileManager 'attributesOfItemAtPath:error:' does not traverse a link? (From: Tito Ciuro <email@hidden>)
 >Re: NSFileManager 'attributesOfItemAtPath:error:' does not traverse a link? (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: NSFileManager 'attributesOfItemAtPath:error:' does not traverse a link?
  • Next by Date: Re: six things I wasn't able to do with Cocoa
  • Previous by thread: Re: NSFileManager 'attributesOfItemAtPath:error:' does not traverse a link?
  • Next by thread: Spotlight SDK replacement on iPad/iPhone
  • Index(es):
    • Date
    • Thread