def find_project_dir(runpath):
    """
    Scans up directories until it finds the project folder.
    :param runpath: pathlib.Path, where summit_core is called from.
    :return: pathlib.Path, the base project directory
    """
    runpath = runpath.resolve()

    if runpath.name == "Summit" or runpath.name == 'summit_master':
        return runpath
    else:
        runpath = runpath / '..'
        return find_project_dir(runpath)