Resolve relative paths with the proper cwd

realpath(3) resolves relative paths with the directory of the executable,
instead we need to get the cwd from the runtime.