From ed8fc98507078f7a35378aa25ca0b8dfb5cded57 Mon Sep 17 00:00:00 2001 From: qiuwenchen Date: Sun, 15 Sep 2024 00:29:16 +0800 Subject: [PATCH] Add python script --- tools/GetHeaderSearchPath.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tools/GetHeaderSearchPath.py diff --git a/tools/GetHeaderSearchPath.py b/tools/GetHeaderSearchPath.py new file mode 100644 index 000000000..faf227745 --- /dev/null +++ b/tools/GetHeaderSearchPath.py @@ -0,0 +1,21 @@ +import os +import sys + +def has_header_files(path): + for entry in os.scandir(path): + if entry.is_file() and (entry.name.endswith('.h') or entry.name.endswith('.hpp')): + return True + return False + +if len(sys.argv) != 2: + print("用法: python script.py <目录路径>") + sys.exit(1) + +directory_path = sys.argv[1] + +for root, dirs, files in os.walk(directory_path): + dirs[:] = [dir for dir in dirs if 'test' not in dir.lower() and 'support' not in dir.lower() and 'java' not in dir.lower() and 'swift' not in dir.lower() and 'xcodeproj' not in dir.lower()] + for dir in dirs: + dir_path = os.path.join(root, dir) + if has_header_files(dir_path): + print(os.path.relpath(dir_path, directory_path)) \ No newline at end of file