Skip to content

Commit b4806ec

Browse files
committed
Add PATH printing before/after install in setup_env_min.ps1
1 parent b7d838b commit b4806ec

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

scripts/windows/setup_env_min.ps1

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,33 @@ function Refresh-SessionPath {
159159
$env:Path = "$machinePath;$userPath"
160160
}
161161

162+
# Print PATH entries one per line for quick verification (scope: Session|Machine|User)
163+
function Print-PathEntries {
164+
param(
165+
[ValidateSet("Session","Machine","User")]
166+
[string]$Scope = "Session"
167+
)
168+
169+
switch ($Scope) {
170+
'Session' { $pathValue = $env:Path }
171+
'Machine' { $pathValue = [Environment]::GetEnvironmentVariable('Path', 'Machine') }
172+
'User' { $pathValue = [Environment]::GetEnvironmentVariable('Path', 'User') }
173+
}
174+
175+
if (-not $pathValue) {
176+
Write-Warn "PATH ($Scope) is empty or not available."
177+
return
178+
}
179+
180+
Write-Info "PATH ($Scope) entries (one per line):"
181+
$entries = $pathValue -split ';' | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne '' }
182+
$index = 0
183+
foreach ($entry in $entries) {
184+
$index++
185+
Write-Host (" {0:D2}: {1}" -f $index, $entry)
186+
}
187+
}
188+
162189
function Install-Maven {
163190
if (Test-CommandExists "mvn") {
164191
Write-Warn "mvn already available. Skipping Maven install."
@@ -266,6 +293,11 @@ if ($DryRun) {
266293
Write-Host "===> Mode: Silent (default)." -ForegroundColor Yellow
267294
}
268295

296+
# Print PATH before installation for quick verification
297+
Print-PathEntries -Scope "Session"
298+
Print-PathEntries -Scope "Machine"
299+
Print-PathEntries -Scope "User"
300+
269301
if ($Help) {
270302
Write-Host "" -ForegroundColor Cyan
271303
Write-Host "Usage: .\scripts\windows\setup_env_min.ps1 [ -DryRun ] [ -Interactive ] [ -Silent ] [ -Help ]" -ForegroundColor Cyan
@@ -315,6 +347,11 @@ Refresh-SessionPath
315347

316348
Set-JavaHome
317349

350+
# Rebuild session path after JAVA_HOME changes and print PATH after installation
351+
Refresh-SessionPath
352+
Print-PathEntries -Scope "Session"
353+
Print-PathEntries -Scope "User"
354+
318355
Invoke-Verify
319356

320357
Write-Host "`n`nAwesome, all set!" -ForegroundColor Green

0 commit comments

Comments
 (0)