Make realpath be more env agnostic