diff --git a/README.md b/README.md index 39fa5153f044bd6cd3377520a486beef78cbfe49..9bbe6fc20f6ec8e3b97274a6391da4d1f4e126bf 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ cd src/lib ./src/lib/joern/joern --script src/lib/scripts/gen_cfg.sc --param """codeFiles=FileParser.py""" ``` ## Note -For now only work on Linux (Windows command is mucho different) +For now only testes in windows and linux Regex to find uncommented print statement ```sh diff --git a/src/lib/FileReader.py b/src/lib/FileReader.py index e8bc7338c296286957d10daff53ad45868e658c4..a216f1c52cd76f21201232f1e90416f89066c984 100644 --- a/src/lib/FileReader.py +++ b/src/lib/FileReader.py @@ -4,6 +4,7 @@ from lib.utils import format_log from typing import Optional from lib.CFGGenerator import CFGGenerator,CFG from lib.custom_class import ElementContext +from sys import platform class FileReader: ANNOTATION_PATTERN = "\S*@.+" def __init__(self, project_path:str)->None: @@ -152,7 +153,11 @@ class FileReader: for root, dirs, files in os.walk(self.project_path): for file in files: if(self.is_source_code_supported(file)): - file_list.append(f"{root}\\{file}") + if platform.startswith("win"): + # Windows use \ to separate + file_list.append(f"{root}\\{file}") + else: + file_list.append(f"{root}/{file}") return file_list def is_source_code_supported(self,filename:str)->bool: