Re: Normalizing a path containing a symlink
Re: Normalizing a path containing a symlink
- Subject: Re: Normalizing a path containing a symlink
- From: Charles Srstka <email@hidden>
- Date: Sat, 16 Nov 2013 12:52:41 -0600
On Nov 16, 2013, at 12:24 PM, Mike Abdullah <email@hidden> wrote:
> How about using -fileReferenceURL on everything? That won't give you a normalized *path* as such, but should give you consistent URLs for identifying individual files
>
> Mike.
You could also use getResourceValue:forKey:error: on the URLs with NSURLFileResourceIdentifierKey as the key, and compare the resulting objects.
The one caveat of this is that the file resource identifiers will be equal if the files have the same inode, so comparing two hard links of the same file (for example, /bin/rm and /bin/unlink) will turn up the result that the files are equal, despite having different paths. If that isn't an issue, though, then this is a pretty consistent way to compare files.
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