* Pre-#535 installs wrote the global entry to `%APPDATA%/opencode` — a dir * today's opencode never reads. Returns that legacy dir when it could hold * stale state (APPDATA set and resolving somewhere other than the real config * dir). Gated on the env var rather than `process.platform` so the cl
()
| 86 | * in real life and this is a no-op. |
| 87 | */ |
| 88 | function legacyWindowsConfigDir(): string | null { |
| 89 | const appData = process.env.APPDATA; |
| 90 | if (!appData || !appData.trim()) return null; |
| 91 | const legacy = path.join(appData, 'opencode'); |
| 92 | return path.resolve(legacy) === path.resolve(globalConfigDir()) ? null : legacy; |
| 93 | } |
| 94 | |
| 95 | function configBaseDir(loc: Location): string { |
| 96 | return loc === 'global' ? globalConfigDir() : process.cwd(); |
no test coverage detected