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

Function getConfigDir

apps/desktop/src/main/app-config.ts:335–351  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

333/** Resolve the config directory, honoring overrides in priority order:
334 * $ZENNOTES_CONFIG_DIR → $XDG_CONFIG_HOME/zennotes → platform default. */
335export function getConfigDir(): string {
336 const explicit = process.env.ZENNOTES_CONFIG_DIR?.trim()
337 if (explicit) return explicit
338
339 const xdg = process.env.XDG_CONFIG_HOME?.trim()
340 if (xdg) return path.join(xdg, 'zennotes')
341
342 if (process.platform === 'win32') {
343 const appData = process.env.APPDATA?.trim()
344 const base = appData || path.join(app.getPath('home'), 'AppData', 'Roaming')
345 return path.join(base, 'zennotes')
346 }
347
348 // Linux + macOS: ~/.config/zennotes (the issue explicitly asks for this on
349 // macOS too, rather than ~/Library/Application Support).
350 return path.join(app.getPath('home'), '.config', 'zennotes')
351}
352
353export function getConfigFilePath(): string {
354 return path.join(getConfigDir(), CONFIG_FILE_NAME)

Callers 4

getCustomThemesDirFunction · 0.90
app-config.test.tsFile · 0.90
getOverridesDirFunction · 0.90
getConfigFilePathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected