I'm writing a little piece of code in which I should detect if an NSURL
contains a symbolic link (i.e., symbolic file components other than the last one should also be detected). To do this, I confront the NSURL
itself with the NSURL
returned by -URLByResolvingSymlinksInPath
. The problem is that this method seems to return all symbolic links in lowercase. Is there another way to solve this problem?
Resolving all symbolic links in NSURL
2.3k Views Asked by Nickkk At
2
There are 2 best solutions below
1

You can traverse symlinks manually:
Detect symbolic link using
-[NSFileManager attributesOfItemAtPath:error:]
and in keyNSFileType
search forNSFileTypeSymbolicLink
value.Get destination path using
-[NSFileManager destinationOfSymbolicLinkAtPath:error:]
and append them.
Repeat this for every path component.
Either I really did something wrong or this bug was fixed with the latest Mountain Lion update. Now all symlinks are correctly resolved.