Now creating a pathfixer.ps1 that will try to fix the path after the installs.

master
Zed A. Shaw 4 weeks ago
parent 1ef9a4ad98
commit 837782c1d7
  1. 13
      base.ps1
  2. 30
      pathfixer.ps1

@ -275,19 +275,14 @@ if($env:PATH.contains($winlibsPath)) {
}
$gitPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$env:APPDATA\..\Local\Programs\Git\cmd")
Write-Warning "============= GIT CHECK ==========="
if($env:PATH.contains($gitPath)) {
Write-Warning "!! Looks like your git installed correctly, but if it fails to run then uninstall it with 'winget remove git.git' then install it again with 'winget install git.git'"
Write-Host "!! Looks like your git installed correctly, but if it fails to run then uninstall it with 'winget remove git.git' then install it again with 'winget install git.git'"
} else {
Write-Warning "!! Git.Git did not add itself to the Path. The directory $gitPath is missing so I'll add it now."
$newPath = $env:PATH + ";$gitPath"
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
if($env:PATH.contains($gitPath)) {
Write-Warning "?? Great, git is in the path so if it is gone after this then something is going on."
} else {
Write-Warning "!!!!!!!!!!!!!!!!!!!!! Despite manually forcing the git $gitPath into the path it is _still_ not there."
Write-Warning "You'll have to manually install git later with: winget install git.git."
winget remove git.git
}
Write-Host "!!!!!!!! You should get the pathfixer.ps1 script to attempt to force $gitPath into the user PATH."
Write-Host "You do this the same way you got this script, just replace base.ps1 with pathfixer.ps1"
}

@ -0,0 +1,30 @@
Write-Host "======= winlibs configuration ====="
$winlibsPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$env:APPDATA\..\Local\Programs\WinLibs")
if($env:PATH.contains($winlibsPath)) {
Write-Warning "!! Detected $winLibsPath in your PATH. Will not update your PATH."
Write-Host "Looks like your WinLibs is working."
} else {
$newPath = $env:PATH + ";$winlibsPath\mingw64\bin"
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
}
Write-Host "====== git path configuration ======"
$gitPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$env:APPDATA\..\Local\Programs\Git\cmd")
if($env:PATH.contains($gitPath)) {
Write-Warning "!! Detected $gitPath in your PATH. Will not update your PATH."
Write-Host "Looks like your git installed correctly, but if it fails to run then uninstall it with 'winget remove git.git' then install it again with 'winget install git.git'"
} else {
Write-Warning "!! Git.Git did not add itself to the Path. The directory $gitPath is missing so I'll add it now."
$newPath = $env:PATH + ";$gitPath"
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
Write-Warning "!!!!!!!!!!! If git doesn't work after this you'll have to manually remove it and add it with:"
Write-Host "winget remove git.git"
Write-Host "winget install git.git"
}
Write-Warning "================================"
Write-Warning "You should now close this terminal, start a new one, and run this script again to confirm your paths are set."
Loading…
Cancel
Save