def get_home()

in alibabacloud_credentials/utils/auth_util.py [0:0]


def get_home():
    if platform.system() == 'Windows':
        home = os.getenv('HOME')
        home_path = os.getenv('HOMEPATH')
        home_drive = os.getenv('HOMEDRIVE')
        if home:
            return home
        elif home_path:
            has_drive_in_home_path = bool(re.match(r'^[A-Za-z]:', home_path))
            return home_path if has_drive_in_home_path else os.path.join(home_drive or '', home_path)
        else:
            return os.path.expanduser("~")
    else:
        return os.getenv('HOME') or os.getenv('HOMEPATH') or os.path.expanduser("~")