def create_project(location, with_ui=False, template=None):
    """
    Create a ZeroVM application project by writing a default `zapp.yaml` in the
    specified directory `location`.

    :param location:
            Directory location to place project files.
    :param with_ui:
        Defaults to `False`. If `True`, add basic UI template files as well to
        ``location``.
    :param template:
        Default: ``None``. If no template is specified, use the default project
        template. (See `zpmlib.zapptemplate`.)

    :returns: List of created project files.
    """
    if os.path.exists(location):
        if not os.path.isdir(location):
            # target must be an empty directory
            raise RuntimeError("Target `location` must be a directory")
    else:
        os.makedirs(location)

    # Run the template builder, and create additional files for the project by
    # the type. If ``template`` is none, this is essientially a NOP.
    # TODO: just use the afc._created_files
    created_files = []
    with util.AtomicFileCreator() as afc:
        for file_type, path, contents in zapptemplate.template(
                location, template, with_ui=with_ui):
            afc.create_file(file_type, path, contents)
            created_files.append(path)
    return created_files