跨平台改造:LOG_DIR改用os.homedir(),v5同步至WSL版(/root/.config/opencode)修复WSL插件failed

This commit is contained in:
ypshidifu
2026-09-22 23:00:15 +08:00
parent d6048da95f
commit c1cb45bed4
+3 -2
View File
@@ -1,9 +1,10 @@
import { Plugin } from "@opencode/plugin/tui"
import { appendFileSync, mkdirSync, existsSync } from "fs"
import { join } from "path"
import { homedir } from "os"
// ── 日志 ──────────────────────────────────────────────────────────────
const LOG_DIR = "C:\\Users\\ypshidifu\\.config\\opencode"
// ── 日志(跨平台:Windows C:\Users\... / WSL /root)────────────────────
const LOG_DIR = join(homedir(), ".config", "opencode")
const LOG_FILE = join(LOG_DIR, "oc-session-all.log")
if (!existsSync(LOG_DIR)) {
mkdirSync(LOG_DIR, { recursive: true })