fix: batch fix invalid shell quotes in config files (safe python script)

This commit is contained in:
yczpf2019
2026-01-24 18:57:29 +08:00
parent e76956c4bc
commit 7cd59ef596
22 changed files with 98 additions and 77 deletions

21
fix_configs.py Normal file
View File

@@ -0,0 +1,21 @@
import os
import json
boards_dir = r"D:\DE-MIXLY\mixly3-server\mixly\boards"
for root, dirs, files in os.walk(boards_dir):
for file in files:
if file == "config.json":
file_path = os.path.join(root, file)
try:
with open(file_path, "r", encoding="utf-8") as f:
content = f.read()
new_content = content.replace('\\"{esptool}\\"', '{esptool}').replace('\\"{ampy}\\"', '{ampy}')
if content != new_content:
print(f"Fixing: {file_path}")
with open(file_path, "w", encoding="utf-8") as f:
f.write(new_content)
except Exception as e:
print(f"Error processing {file_path}: {e}")