File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
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 ))
You can’t perform that action at this time.
0 commit comments