()
| 333 | /** Resolve the config directory, honoring overrides in priority order: |
| 334 | * $ZENNOTES_CONFIG_DIR → $XDG_CONFIG_HOME/zennotes → platform default. */ |
| 335 | export 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 | |
| 353 | export function getConfigFilePath(): string { |
| 354 | return path.join(getConfigDir(), CONFIG_FILE_NAME) |
no outgoing calls
no test coverage detected