-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy_libs.py
More file actions
40 lines (29 loc) · 1.42 KB
/
Copy pathcopy_libs.py
File metadata and controls
40 lines (29 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
import shutil
import argparse
def copy_lib_files(src_dir: str, dest_dir: str):
for root, dirs, files in os.walk(src_dir):
for file in files:
if file.endswith('.lib') and (file.startswith('dawn_') or file.startswith('webgpu_')):
src_file = os.path.join(root, file)
# 判断源路径中是否包含 Debug 或 Release 字样
if 'Debug' in root:
final_dest_dir = os.path.join(dest_dir, 'debug')
elif 'Release' in root:
final_dest_dir = os.path.join(dest_dir, 'release')
else:
final_dest_dir = dest_dir
# 创建目标子目录(如果不存在)
if not os.path.exists(final_dest_dir):
os.makedirs(final_dest_dir)
dest_file = os.path.join(final_dest_dir, file)
shutil.copy2(src_file, dest_file)
print(f"Copied: {src_file} to {dest_file}")
for dir in dirs:
copy_lib_files(os.path.join(root, dir), dest_dir)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="复制文件从源目录到目标目录")
parser.add_argument("source_dir", type=str, help="源目录路径")
parser.add_argument("target_dir", type=str, help="目标目录路径")
args = parser.parse_args()
copy_lib_files(args.source_dir, args.target_dir)