refactor findPathForFile
refactor findPathForFile