Re: Normalizing a path containing a symlink
Re: Normalizing a path containing a symlink
- Subject: Re: Normalizing a path containing a symlink
- From: Ken Thomases <email@hidden>
- Date: Sat, 16 Nov 2013 23:31:20 -0600
On Nov 16, 2013, at 3:28 PM, Rick Mann wrote:
> The thing I'm trying to accomplish is to iterate all the files in a subtree, and then compute the last few parts of the path from that top-level directory.
>
> I get the top-level directory by asking for the documents directory, and it gives me "/var/.../Documents/" (to which I append "Foo"). I then get the contents of that directory, but it gives me all the paths as "/private/var/.../Foo/...". This makes it hard to determine the least path that makes them unique without hard-coding knowledge about "/private" into my code.
Which method are you using to enumerate the contents of the directory? If you're using URLs, are you logging/examining the URLs or are you asking the URLs for their path and logging/examining those? I haven't checked, but it's possible that the URLs are relative (with the base being the directory being enumerated) but are being converted to absolute when you ask for the path.
The old path-string-based API -[NSFileManager enumeratorAtPath:] provides you with just the relative path – you have to manually combine it with the path to the directory being enumerated if you want the full path. So, you might use that since you're doing path string processing anyway.
Regards,
Ken
_______________________________________________
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