Alternatively, syscall readlink(2) and some C hack may come to help. On Nov 14, 2013, at 11:27, Rick Mann <rm...@latencyzero.com> wrote:
> In my iOS app, I create a directory in the user’s Documents directory, and > then later iterate the contents of that directory. The problem is that on > iOS, that directory has a path like “/var/stuff/Documents/Dir”, and when I > iterate it, the resulting contents have paths like > “/private/var/stuff/Documents/Dir/item”. > > This is fine, except that there comes a point where I have to compare my > original “/var/…” path to one of the ones I've found, and get the relative > part. This fails, since my path starts with "/var", and the items' paths > start with "/private". > > Is there a way to normalize a path such that any symbolic links in it are > resolved and the "real" path is created? I tried -[NSURL > URLByResolvingSymlinksInPath], but that either doesn't work, or strips off > the "/private" of the result. That is, I get a "/var" path. > > Alternatively, I can strip "/private" off any path I get while iterating, but > that strikes me as fragile. > > Oh, it turns out I can use -URLByResolvingSymlinksInPath on the items > returned while iterating the directory. > > Whatever it is, it's messy. > > -- > Rick > > > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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/xcvista%40me.com > > This email sent to xcvi...@me.com
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com