Files
blog/tmp_fixcfg.py
T
2026-06-01 17:57:22 +08:00

18 lines
814 B
Python

# Fix remaining writebot/internal/config -> writebot/internal/botcfg in all bot-go files
import os, re
for root, dirs, files in os.walk(r"E:\GitHub\blog\bot-go"):
for fn in files:
if fn.endswith(".go"):
fp = os.path.join(root, fn)
with open(fp, "rb") as f:
content = f.read().decode("utf-8")
# Don't modify files in the old internal directories we're replacing
if "old_" in fp:
continue
content = content.replace('"writebot/internal/config"', '"writebot/internal/botcfg"')
content = re.sub(r'writebot/internal/config\b', 'writebot/internal/botcfg', content)
with open(fp, "wb") as f:
f.write(content.encode("utf-8"))
print("All config references updated to botcfg")