Have you considered using the VimL helpers for finding a dir? Here I used `findfile` (https://github.com/alfredodeza/coveragepy.vim/blob/master/ftplugin/python/coveragepy.vim#L68-75) but if you read the docs on `finddir()` you will see this function can be more simplified and probably more efficient :)