(code examples in macruby syntax)
If I create an url with:
u1 = NSURL.fileURLWithPath('/tmp')
and then try to create an url with symlinks resolved:
u2=u1.URLByResolvingSymlinksInPath
I get back /tmp:
irb(main):010:0> u2.pathComponents
=> ["/", "tmp"]
This is a problem because if I create an NSDirectoryEnumerator with this NSURL (or /var or /etc), and prefetch the NSURLParentDirectoryURLKey, the NSURLs returned will have path /private/tmp/...
I need to get the components of the directory paths that are relative to the root of the NSDirectoryEnumerator. Is there a robust way to do this, other than hardcoded detection of the special cases I know about (which so far are /tmp, /var, and /etc)?
Is anyone aware of other "special" directories on which URLByResolvingSymlinksInPath doesn't work?