def check_file_name(self, path): found = False path = common.to_unix_path(path) for engine in self.engines: #print("==> Checking whether the game is made by " + engine["name"]) for keyword in engine["file_name_keywords"]: if re.search(keyword, path): self._set_engine_name(engine["name"]) self.result["matched_file_name_keywords"].add(keyword) if self.result["engine"] != "unknown": found = True break return found
def _need_to_check_file_content(self, path): "Check whether the file is an executable file" path = common.to_unix_path(path) for k in self.no_need_to_check_file_content: m = re.search(k, path) if m: #print("==> Not need to check content: (%s)" % m.group(0)) return False for keyword in self.check_file_content_keywords: m = re.search(keyword, path) if m: #print("==> Found file to check content: (%s)" % m.group(0)) return True return False