from typing import List
from typing import Tuple
import pathlib


def create_build_script(template_name: str, vars: List[Tuple[str, str]]) -> pathlib.Path:
    """
    Create the Steam build script

    Use the given template and template variable tuple list.

    Returns pathlib.Path to the created script.

    Args:
        template_name (str): [description]
        vars (List[Tuple[str, str]]): [description]

    Returns:
        pathlib.Path: Full path to the generated script
    """
    build_script = pathlib.Path(".", template_name).read_text()
    for var in vars:
        build_script = build_script.replace(var[0], var[1])
    build_script_file = template_name.replace(".template", "")
    build_script_path = pathlib.Path(".", build_script_file)
    build_script_path.write_text(build_script)
    return build_script_path