-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba095b4
commit ed8fc98
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |