def validate_within_subproject(self, subdir, fname):
    srcdir = Path(self.environment.source_dir)
    norm = Path(srcdir, subdir, fname).resolve()
    if os.path.isdir(norm):
        inputtype = 'directory'
    else:
        inputtype = 'file'
    if (srcdir not in norm.parents):
        return
    project_root = Path(srcdir, self.root_subdir)
    subproject_dir = (project_root / self.subproject_dir)
    if (norm == project_root):
        return
    if (project_root not in norm.parents):
        raise InterpreterException(f'Sandbox violation: Tried to grab {inputtype} {norm.name} outside current (sub)project.')
    if ((subproject_dir == norm) or (subproject_dir in norm.parents)):
        raise InterpreterException(f'Sandbox violation: Tried to grab {inputtype} {norm.name} from a nested subproject.')
def validate_within_subproject(self, subdir, fname):
    srcdir = Path(self.environment.source_dir)
    norm = Path(srcdir, subdir, fname).resolve()
    if os.path.isdir(norm):
        inputtype = 'directory'
    else:
        inputtype = 'file'
    if (srcdir not in norm.parents):
        return
    project_root = Path(srcdir, self.root_subdir)
    subproject_dir = (project_root / self.subproject_dir)
    if (norm == project_root):
        return
    if (project_root not in norm.parents):
        raise InterpreterException(f'Sandbox violation: Tried to grab {inputtype} {norm.name} outside current (sub)project.')
    if ((subproject_dir == norm) or (subproject_dir in norm.parents)):
        raise InterpreterException(f'Sandbox violation: Tried to grab {inputtype} {norm.name} from a nested subproject.')