import shutil
from pathlib import Path


def get_tc_exec(command):
    """Returns the location of the RDAAM_He or ketch_aft executable"""
    if shutil.which(command) is not None:
        tc_exec = command
    elif Path("bin/" + command).is_file():
        tc_exec = "bin/" + command
    else:
        raise FileNotFoundError(
            f"Age calculation program {command} not found. See Troubleshooting in tcplotter docs online."
        )
    return tc_exec