Candidate bundle install dirs: the running binary's own, plus the defaults.
(p: RemoveBinaryProbes)
| 111 | |
| 112 | /** Candidate bundle install dirs: the running binary's own, plus the defaults. */ |
| 113 | function installDirCandidates(p: RemoveBinaryProbes): string[] { |
| 114 | const P = pathFor(p.platform); |
| 115 | const dirs: string[] = []; |
| 116 | const method = detectInstallMethod({ |
| 117 | filename: p.filename, |
| 118 | platform: p.platform, |
| 119 | cwd: p.cwd, |
| 120 | exists: p.exists, |
| 121 | }); |
| 122 | if (method.kind === 'bundle' && method.installDir) dirs.push(method.installDir); |
| 123 | if (p.env.CODEGRAPH_INSTALL_DIR) dirs.push(p.env.CODEGRAPH_INSTALL_DIR); |
| 124 | // Platform defaults — probed even when the RUNNING binary is npm/source, |
| 125 | // because the whole point is clearing installs the user forgot about. |
| 126 | if (p.platform === 'win32') { |
| 127 | if (p.env.LOCALAPPDATA) dirs.push(P.join(p.env.LOCALAPPDATA, 'codegraph')); |
| 128 | } else { |
| 129 | dirs.push(stateDir(p)); |
| 130 | } |
| 131 | return [...new Set(dirs.map((d) => P.resolve(d)))]; |
| 132 | } |
| 133 | |
| 134 | export function planBinaryRemoval(p: RemoveBinaryProbes): BinaryRemovalPlan { |
| 135 | const P = pathFor(p.platform); |
no test coverage detected