feat: separate writable data dir from program dir (LAN update groundwork)

- add get_data_dir() with CMBOT_DATA_DIR override, fallback to program dir
- point config/logs/output at the data root; resources stay on program root
- harden config/template writes with parents=True for a deep data root
- add docs/10-lan-update.md (LAN auto-update design); default install root
  %LOCALAPPDATA%\CMBot for elevation-free self-update

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 16:29:47 +08:00
co-authored by Claude Opus 4.8
parent 7a1b9d8330
commit 76f2c6dd5b
4 changed files with 288 additions and 13 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ def save_config(data):
config_file = get_config_path(_CONFIG_FILENAME)
try:
config_file.parent.mkdir(exist_ok=True)
config_file.parent.mkdir(parents=True, exist_ok=True)
with open(str(config_file), "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=2)
logger.info("Config saved to %s", config_file)