mirror of
https://github.com/goldenfishs/MRobot.git
synced 2026-04-01 05:17:13 +08:00
修一下
This commit is contained in:
@@ -278,11 +278,11 @@ class DeviceSimple(QWidget):
|
||||
with open(dst_path, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
# 复制设备文件夹下的其他文件(如 lcd_lib.h)
|
||||
# 复制设备文件夹下的其他额外文件(如 lcd_lib.h)
|
||||
if os.path.exists(device_template_dir):
|
||||
import shutil
|
||||
for item in os.listdir(device_template_dir):
|
||||
# 跳过已处理的文件
|
||||
# 跳过已处理的主要文件
|
||||
if item in files_to_process:
|
||||
continue
|
||||
|
||||
@@ -291,11 +291,9 @@ class DeviceSimple(QWidget):
|
||||
|
||||
# 只复制文件,不复制子目录
|
||||
if os.path.isfile(src_file):
|
||||
# 检查文件是否已存在,避免覆盖
|
||||
if not os.path.exists(dst_file):
|
||||
os.makedirs(os.path.dirname(dst_file), exist_ok=True)
|
||||
shutil.copy2(src_file, dst_file)
|
||||
print(f"复制额外文件: {dst_file}")
|
||||
os.makedirs(os.path.dirname(dst_file), exist_ok=True)
|
||||
shutil.copy2(src_file, dst_file)
|
||||
print(f"复制设备额外文件: {item}")
|
||||
|
||||
self._save_config()
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user