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 ───────────────────────────────────────────────────────────
|
# ── 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'
|
$gitExe = Join-Path $gitDir 'bin\git.exe'
|
||||||
|
|
||||||
if (Test-Path $gitExe) {
|
if (Test-Path $gitExe) {
|
||||||
@@ -1079,9 +1079,10 @@ if (Test-Path $sevenZipExe) {
|
|||||||
Write-Host "7-Zip installed."
|
Write-Host "7-Zip installed."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Refresh PATH whether freshly installed or already present
|
# 7-Zip MSI does NOT add to system PATH — inject directory directly
|
||||||
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' +
|
if ($env:PATH -notlike "*$sevenZipDir*") {
|
||||||
[System.Environment]::GetEnvironmentVariable('PATH', 'User')
|
$env:PATH = $env:PATH + ";$sevenZipDir"
|
||||||
|
}
|
||||||
|
|
||||||
# Validation
|
# Validation
|
||||||
Assert-Step '7-Zip' '7z.exe exists at expected path' {
|
Assert-Step '7-Zip' '7z.exe exists at expected path' {
|
||||||
|
|||||||
Reference in New Issue
Block a user