* 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
()
| 74 | * in real life and this is a no-op. |
| 75 | */ |
| 76 | function legacyWindowsConfigDir(): string | null { |
| 77 | const appData = process.env.APPDATA; |
| 78 | if (!appData || !appData.trim()) return null; |
| 79 | const legacy = path.join(appData, 'opencode'); |
| 80 | return path.resolve(legacy) === path.resolve(globalConfigDir()) ? null : legacy; |
| 81 | } |
| 82 | |
| 83 | function configBaseDir(loc: Location): string { |
| 84 | return loc === 'global' ? globalConfigDir() : process.cwd(); |
no test coverage detected