Skip to content

Commit ed8fc98

Browse files
committed
Add python script
1 parent ba095b4 commit ed8fc98

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tools/GetHeaderSearchPath.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import os
2+
import sys
3+
4+
def has_header_files(path):
5+
for entry in os.scandir(path):
6+
if entry.is_file() and (entry.name.endswith('.h') or entry.name.endswith('.hpp')):
7+
return True
8+
return False
9+
10+
if len(sys.argv) != 2:
11+
print("用法: python script.py <目录路径>")
12+
sys.exit(1)
13+
14+
directory_path = sys.argv[1]
15+
16+
for root, dirs, files in os.walk(directory_path):
17+
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()]
18+
for dir in dirs:
19+
dir_path = os.path.join(root, dir)
20+
if has_header_files(dir_path):
21+
print(os.path.relpath(dir_path, directory_path))

0 commit comments

Comments
 (0)