(deps: EnvironmentDeps)
| 89 | } |
| 90 | |
| 91 | async function locateWindowsGitBash(deps: EnvironmentDeps): Promise<string> { |
| 92 | const checked: string[] = []; |
| 93 | |
| 94 | const override = deps.env['KIMI_SHELL_PATH']?.trim(); |
| 95 | if (override !== undefined && override.length > 0) { |
| 96 | checked.push(override); |
| 97 | if (await deps.isFile(override)) { |
| 98 | return override; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | const gitExecutables = await findExecutablesOnPath( |
| 103 | 'git.exe', |
| 104 | deps.env['PATH'], |
| 105 | deps.platform, |
| 106 | deps.isFile, |
| 107 | ); |
| 108 | |
| 109 | for (const gitExe of gitExecutables) { |
| 110 | const inferred = gitBashCandidatesFromGitExe(gitExe); |
| 111 | if (inferred !== undefined) { |
| 112 | for (const candidate of inferred) { |
| 113 | checked.push(candidate); |
| 114 | if (await deps.isFile(candidate)) { |
| 115 | return candidate; |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | const gitExecPath = await readGitExecPath(deps, gitExe); |
| 121 | if (gitExecPath === undefined) { |
| 122 | continue; |
| 123 | } |
| 124 | for (const candidate of gitBashCandidatesFromGitExecPath(gitExecPath)) { |
| 125 | checked.push(candidate); |
| 126 | if (await deps.isFile(candidate)) { |
| 127 | return candidate; |
| 128 | } |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | const candidates: string[] = [ |
| 133 | 'C:\\Program Files\\Git\\bin\\bash.exe', |
| 134 | 'C:\\Program Files\\Git\\usr\\bin\\bash.exe', |
| 135 | 'C:\\Program Files (x86)\\Git\\bin\\bash.exe', |
| 136 | 'C:\\Program Files (x86)\\Git\\usr\\bin\\bash.exe', |
| 137 | ]; |
| 138 | const localAppData = deps.env['LOCALAPPDATA']?.trim(); |
| 139 | if (localAppData !== undefined && localAppData.length > 0) { |
| 140 | candidates.push(`${localAppData}\\Programs\\Git\\bin\\bash.exe`); |
| 141 | candidates.push(`${localAppData}\\Programs\\Git\\usr\\bin\\bash.exe`); |
| 142 | } |
| 143 | for (const candidate of candidates) { |
| 144 | checked.push(candidate); |
| 145 | if (await deps.isFile(candidate)) { |
| 146 | return candidate; |
| 147 | } |
| 148 | } |
no test coverage detected