Use script to calculate prefix path if missing

This make relative path handling a bit easier to manage and helps nested dependencies in alternative locations still resolve.