@FeatureNewKwargs('subdir', '0.44.0', ['if_found'])
@permittedKwargs(permitted_kwargs['subdir'])
def func_subdir(self, node, args, kwargs):
    self.validate_arguments(args, 1, [str])
    mesonlib.check_direntry_issues(args)
    if ('..' in args[0]):
        raise InvalidArguments('Subdir contains ..')
    if ((self.subdir == '') and (args[0] == self.subproject_dir)):
        raise InvalidArguments('Must not go into subprojects dir with subdir(), use subproject() instead.')
    if ((self.subdir == '') and args[0].startswith('meson-')):
        raise InvalidArguments('The "meson-" prefix is reserved and cannot be used for top-level subdir().')
    for i in mesonlib.extract_as_list(kwargs, 'if_found'):
        if (not hasattr(i, 'found_method')):
            raise InterpreterException('Object used in if_found does not have a found method.')
        if (not i.found_method([], {})):
            return
    prev_subdir = self.subdir
    subdir = os.path.join(prev_subdir, args[0])
    if os.path.isabs(subdir):
        raise InvalidArguments('Subdir argument must be a relative path.')
    absdir = os.path.join(self.environment.get_source_dir(), subdir)
    symlinkless_dir = os.path.realpath(absdir)
    if (symlinkless_dir in self.visited_subdirs):
        raise InvalidArguments(('Tried to enter directory "%s", which has already been visited.' % subdir))
    self.visited_subdirs[symlinkless_dir] = True
    self.subdir = subdir
    os.makedirs(os.path.join(self.environment.build_dir, subdir), exist_ok=True)
    buildfilename = os.path.join(self.subdir, environment.build_filename)
    self.build_def_files.append(buildfilename)
    absname = os.path.join(self.environment.get_source_dir(), buildfilename)
    if (not os.path.isfile(absname)):
        self.subdir = prev_subdir
        raise InterpreterException("Non-existent build file '{!s}'".format(buildfilename))
    with open(absname, encoding='utf8') as f:
        code = f.read()
    assert isinstance(code, str)
    try:
        codeblock = mparser.Parser(code, absname).parse()
    except mesonlib.MesonException as me:
        me.file = absname
        raise me
    try:
        self.evaluate_codeblock(codeblock)
    except SubdirDoneRequest:
        pass
    self.subdir = prev_subdir
@FeatureNewKwargs('subdir', '0.44.0', ['if_found'])
@permittedKwargs(permitted_kwargs['subdir'])
def func_subdir(self, node, args, kwargs):
    self.validate_arguments(args, 1, [str])
    mesonlib.check_direntry_issues(args)
    if ('..' in args[0]):
        raise InvalidArguments('Subdir contains ..')
    if ((self.subdir == ) and (args[0] == self.subproject_dir)):
        raise InvalidArguments('Must not go into subprojects dir with subdir(), use subproject() instead.')
    if ((self.subdir == ) and args[0].startswith('meson-')):
        raise InvalidArguments('The "meson-" prefix is reserved and cannot be used for top-level subdir().')
    for i in mesonlib.extract_as_list(kwargs, 'if_found'):
        if (not hasattr(i, 'found_method')):
            raise InterpreterException('Object used in if_found does not have a found method.')
        if (not i.found_method([], {})):
            return
    prev_subdir = self.subdir
    subdir = os.path.join(prev_subdir, args[0])
    if os.path.isabs(subdir):
        raise InvalidArguments('Subdir argument must be a relative path.')
    absdir = os.path.join(self.environment.get_source_dir(), subdir)
    symlinkless_dir = os.path.realpath(absdir)
    if (symlinkless_dir in self.visited_subdirs):
        raise InvalidArguments(('Tried to enter directory "%s", which has already been visited.' % subdir))
    self.visited_subdirs[symlinkless_dir] = True
    self.subdir = subdir
    os.makedirs(os.path.join(self.environment.build_dir, subdir), exist_ok=True)
    buildfilename = os.path.join(self.subdir, environment.build_filename)
    self.build_def_files.append(buildfilename)
    absname = os.path.join(self.environment.get_source_dir(), buildfilename)
    if (not os.path.isfile(absname)):
        self.subdir = prev_subdir
        raise InterpreterException("Non-existent build file '{!s}'".format(buildfilename))
    with open(absname, encoding='utf8') as f:
        code = f.read()
    assert isinstance(code, str)
    try:
        codeblock = mparser.Parser(code, absname).parse()
    except mesonlib.MesonException as me:
        me.file = absname
        raise me
    try:
        self.evaluate_codeblock(codeblock)
    except SubdirDoneRequest:
        pass
    self.subdir = prev_subdir