def _user_local_directory()

in scripts/ebcli_installer.py [0:0]


def _user_local_directory():
    """
    Function attempts to find the home of the current user. On Unix/Linux,
    this is $HOME or "~". On Windows, this can be one of $USERPROFILE,
    $LOCALAPPDATA, or $APPDATA. In the event that the home cannot be
    determined, execution will continue normally.
    :return: the home of the current user
    """
    if sys.platform.startswith('win32'):
        identified_location = (
            os.environ.get('USERPROFILE')
            or os.environ.get('LOCALAPPDATA')
            or os.environ.get('APPDATA')
        )
    else:
        identified_location = os.environ.get('HOME')

    if not identified_location:
        _error(
            "Could not determine user's HOME directory. "
            "Pass a location explicitly using the `--location` argument."
        )
    return identified_location