check if path is exists

@dsharkey Here is the pull request.