Re: How to ResolvingSymlinksInPath ?
Re: How to ResolvingSymlinksInPath ?
- Subject: Re: How to ResolvingSymlinksInPath ?
- From: Charles Srstka <email@hidden>
- Date: Fri, 04 Nov 2016 03:58:50 -0500
> On Nov 3, 2016, at 10:39 PM, Ken Thomases <email@hidden> wrote:
>
> On Nov 3, 2016, at 10:08 PM, Gerriet M. Denkmann <email@hidden <mailto:email@hidden>> wrote:
>>
>> URLByResolvingAliasFileAtURL does almost the same, has no special behaviour with “/private”, and even can resolve an alias.
>> But: only when this alias is the final component of a path.
>> I.e. /path/aliasToFoo will be resolved to /path/foo; but /path/aliasToFoo/someFile will not.
>
> Paths "through" alias files make no sense. Nothing else in the system will resolve an alias there, so nothing will ever produce such a path. If your code is producing such paths, you should fix it, because nothing else will be able to process them.
>
>>> On 3 Nov 2016, at 23:05, Jens Alfke <email@hidden <mailto:email@hidden>> wrote:
>>>
>>> (I’m not sure why you need to remove all symlinks, but I’ll assume you have a good reason…)
>>
>> I don’t know whether the reason is good, but I want to compare stuff returned from FSEventStreams.
>
> You should construct NSURL objects from the two paths, use -getResourceValue:forKey:error: with the key NSURLFileResourceIdentifierKey to get the resource ID for each, and then use [resourceID1 isEqual:resourceID2] to determine if the two paths refer to the same file-system object.
One thing that may be worth mentioning is that file resource identifier keys apparently use the inode to compare the files, which means that comparing the file resource identifiers of two hard links that point to the same inode will return true. This is great if that’s what you want, but if you need to determine that they represent the same catalog node rather than the same underlying data, it may not be appropriate.
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