Refer to relative path instead of absolute path

There is no need to refer to the absolute path here if we can use the relative one.
Add unit tests for convertToRelativePath