Avoid adding directories that don't exist to the path.