Make resolvePath a little smarter

Use a "relative path" approach:
- if paths have common parts, make sure to not duplicate those parts
- if there are no common parts, just append

Inspired by the functionality of Node's path.relative