def resolve_gcloud_config_path()

in composer_local_dev/utils.py [0:0]


def resolve_gcloud_config_path() -> str:
    """
    Returns the absolute path the Cloud CLI's configuration directory.
    """
    if constants.CLOUD_CLI_CONFIG_PATH_ENV in os.environ:
        return os.environ[constants.CLOUD_CLI_CONFIG_PATH_ENV]

    if is_windows_os() and "APPDATA" in os.environ:
        config_path = pathlib.Path(os.environ["APPDATA"], "gcloud")
    else:
        config_path = pathlib.Path("~/.config/gcloud").expanduser()
    # TODO (b/234553956) Check if found directory is correct gcloud config
    if config_path.is_dir():
        return str(config_path)
    raise errors.ComposerCliError(constants.GCLOUD_CONFIG_NOT_FOUND_ERROR)