Make sure the parent directories exist.