MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / userDataDir

Function userDataDir

apps/desktop/src/mcp/vault-ops.ts:187–203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

185/* ---------- Path + config helpers ------------------------------------ */
186
187function userDataDir(): string {
188 // Test/automation hook: point the CLI and MCP server at an explicit
189 // config directory instead of the per-OS Electron location.
190 const override = process.env.ZENNOTES_CONFIG_DIR?.trim()
191 if (override) return path.resolve(override)
192
193 // Mirror Electron's `app.getPath('userData')` for product name "ZenNotes".
194 const home = os.homedir()
195 switch (process.platform) {
196 case 'darwin':
197 return path.join(home, 'Library', 'Application Support', 'ZenNotes')
198 case 'win32':
199 return path.join(process.env.APPDATA || path.join(home, 'AppData', 'Roaming'), 'ZenNotes')
200 default:
201 return path.join(process.env.XDG_CONFIG_HOME || path.join(home, '.config'), 'ZenNotes')
202 }
203}
204
205async function readConfigFile(): Promise<Record<string, unknown> | null> {
206 const configPath = path.join(userDataDir(), 'zennotes.config.json')

Callers 1

readConfigFileFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected