path.relative doesn't work as expected

When passing file paths to path.relative it generates a path that I wouldn't expect. Better to use just the dirname of the file instead.