On Nov 16, 2013, at 21:31 , Ken Thomases <[email protected]> wrote:
> 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. I'm using the -contentsOfDirectory method. I then call .path on them. > 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. Hmm, I'll take a look at that, thanks. -- Rick
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Cocoa-dev mailing list ([email protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
