Use `locate-dominating-file` instead of own code