@samitouri / QOSAMI-WSL / commits / 91317945

Verify WinGet config exists before invoking winget configure (#40496)

* Verify WinGet config exists before invoking winget configure If the resolved `` does not exist, `winget configure` fails with a cryptic error rather than telling the user that the config file is missing. Add an explicit `Test-Path` guard that reports the missing file path and the expected location, and update the existing failure message to print the full `` instead of just `` so it matches the path actually passed to `winget configure`. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Retrigger CI --------- Co-authored-by: benhillis <17727402+benhillis@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Ben Hillis committed May 11, 2026 at 12:54 UTC 91317945d553d8093ac3b00f194ec63431e17c39
1 file changed +7 -1
tools/setup-dev-env.ps1
+7 -1
@@ -55,6 +55,12 @@ else
55 }
56
57 $configPath = Join-Path $configDir $configFile
58 +if (-not (Test-Path -LiteralPath $configPath -PathType Leaf))
59 +{
60 + Write-Host "Configuration file not found: $configPath" -ForegroundColor Red
61 + Write-Host "Ensure the repository is fully checked out and the .config folder contains $configFile." -ForegroundColor Yellow
62 + exit 1
63 +}
64
65 # ── Run WinGet Configuration ────────────────────────────────────────
66 Write-Host ""
@@ -72,7 +78,7 @@ if ($LASTEXITCODE -ne 0)
78 winget configure -f "$configPath" --accept-configuration-agreements
79 if ($LASTEXITCODE -ne 0)
80 {
75 - Write-Host "Failed to apply WinGet configuration file: $configFile" -ForegroundColor Red
81 + Write-Host "Failed to apply WinGet configuration file: $configPath" -ForegroundColor Red
82 exit 1
83 }
84