[ARM][Settings][CmdNotFound]Fix CmdNotFound page init (#32892)

On ARM, process does not inherit environment, so PATH variable only contains SYSTEM values.
As pwsh.exe path is in USER PATH, check requirements script on CmdNotFound page load will fail
and as a result all requirements will be shown as missing.

Therefore, on loading, we manually set PATH variable, same as we do after installing pwsh7.
This commit is contained in:
Stefan Markovic 2024-05-17 15:38:37 +02:00 committed by GitHub
parent e1832a0a4a
commit c601a3e3e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -58,6 +58,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_enabledStateIsGPOConfigured = true;
}
// Update PATH environment variable to get pwsh.exe on further calls.
Environment.SetEnvironmentVariable("PATH", (Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine) ?? string.Empty) + ";" + (Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.User) ?? string.Empty), EnvironmentVariableTarget.Process);
CheckCommandNotFoundRequirements();
}