def find_file_in_folder(self, folder, pattern):
        files = list(Path(folder).rglob(pattern))

        if len(files) == 0:
            raise errors.KnownError(f"No file matches pattern [{pattern}].")
        if len(files) > 1:
            logging.warning(
                f"More files match pattern [{pattern}]. Will pick first:\n{files}"
            )

        file = path.join(folder, files[0])
        return Path(file).resolve()
Exemple #2
0
 def verify(self):
     if self.error:
         raise errors.KnownError(self.error)