Check if Path is set and is a directory

cleaned up, a lot