Use `locate-dominating-file’ rather than reimplementing it.