doesn't `isdir` already check whether the path exists?