fix(template): Fix Git skip path + 7-Zip PATH injection
Two root causes: 1. Git skip check used C:\BuildTools\Git but Git installs to C:\Program Files\Git (default). Changed $gitDir to correct path. 2. 7-Zip MSI does not register in system PATH. Registry refresh (GetEnvironmentVariable Machine+User) was picking up empty result. Fixed: inject sevenZipDir directly into $env:PATH if not present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -991,7 +991,7 @@ if (-not (Test-Path $buildToolsRoot)) {
|
||||
}
|
||||
|
||||
# ── Git for Windows ───────────────────────────────────────────────────────────
|
||||
$gitDir = Join-Path $buildToolsRoot 'Git'
|
||||
$gitDir = 'C:\Program Files\Git' # default install location for Git for Windows
|
||||
$gitExe = Join-Path $gitDir 'bin\git.exe'
|
||||
|
||||
if (Test-Path $gitExe) {
|
||||
@@ -1079,9 +1079,10 @@ if (Test-Path $sevenZipExe) {
|
||||
Write-Host "7-Zip installed."
|
||||
}
|
||||
|
||||
# Refresh PATH whether freshly installed or already present
|
||||
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' +
|
||||
[System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
||||
# 7-Zip MSI does NOT add to system PATH — inject directory directly
|
||||
if ($env:PATH -notlike "*$sevenZipDir*") {
|
||||
$env:PATH = $env:PATH + ";$sevenZipDir"
|
||||
}
|
||||
|
||||
# Validation
|
||||
Assert-Step '7-Zip' '7z.exe exists at expected path' {
|
||||
|
||||
Reference in New Issue
Block a user