import platform


def get_current_prefab_platform() -> str:
    """Get the name of the running platform.

    Throws a RuntimeError on unsupported platforms.
    """
    system = platform.system()
    machine = platform.machine()
    if system == 'Darwin':
        # Currently there's just x86_64 on mac;
        # will need to revisit when arm
        # cpus happen.
        return 'mac'
    if system == 'Linux':
        # If it looks like we're in Windows Subsystem for Linux,
        # go with the Windows version.
        if 'microsoft' in platform.uname().release.lower():
            return 'windows'

        # We currently only support x86_64 linux.
        if machine == 'x86_64':
            return 'linux'
        raise RuntimeError(f'make_prefab: unsupported linux machine type:'
                           f' {machine}.')
    raise RuntimeError(f'make_prefab: unrecognized platform:'
                       f' {platform.system()}.')