(name = SETTINGS_STORE)
| 11 | // in index.ts has executed, which would result in files being written to the default directory |
| 12 | // (e.g. bad: %APPDATA%\@opencode-ai\desktop\opencode.settings vs good: %APPDATA%\ai.opencode.desktop.dev\opencode.settings). |
| 13 | export function getStore(name = SETTINGS_STORE) { |
| 14 | const cached = cache.get(name) |
| 15 | if (cached) return cached |
| 16 | const next = new Store({ |
| 17 | name, |
| 18 | cwd: electron.app.getPath("userData"), |
| 19 | fileExtension: "", |
| 20 | accessPropertiesByDotNotation: false, |
| 21 | }) |
| 22 | cache.set(name, next) |
| 23 | return next |
| 24 | } |
| 25 | |
| 26 | export async function removeStoreFileIfEmpty(name: string) { |
| 27 | if (await deleteStoreFileIfEmpty(electron.app.getPath("userData"), name)) cache.delete(name) |
no test coverage detected