dsh-sansheng-liubu/combined/sansheng/src/paths.js

20 lines
656 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { homedir } from 'node:os'
import { join } from 'node:path'
/** DSH 主目录,与宿主一致:优先 DSH_HOME,否则 ~/.dsh。 */
export function dshHome() {
const fromEnv = process.env.DSH_HOME
if (typeof fromEnv === 'string' && fromEnv.trim() !== '') return fromEnv
return join(homedir(), '.dsh')
}
/** DS Bot 自己的状态文件(本插件只读)。 */
export function dsbotStatePath(home = dshHome()) {
return join(home, 'bot', 'state.json')
}
/** 三省六部自己的补充记录(项目绑定、审查记录)。 */
export function sanshengStatePath(home = dshHome()) {
return join(home, 'sansheng', 'state.json')
}