Is this correct? If I have a chain of symlinks, each symlink is relative to the previous link, not to the original path.

If I have symlink `/a/b/c` pointing at `../d/e` and symlink `/a/d/e` pointing at `../f`, following the chain should take me to `/a/f`. But this code is going to resolve it to `/a/b/f`.

I think the solution is to get rid of the `join()`s and just mutate the single `result` path, using `result.pop(); result.push(path)`.