fix: batch fix invalid shell quotes in config files (safe python script)
This commit is contained in:
21
fix_configs.py
Normal file
21
fix_configs.py
Normal 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}")
|
||||
Reference in New Issue
Block a user