diff --git a/base.ps1 b/base.ps1 index dd068f9..d217027 100644 --- a/base.ps1 +++ b/base.ps1 @@ -222,11 +222,11 @@ if(-not $isAdmin) { $installs=@( 'Geany.Geany', + 'Git.Git' 'Genivia.ugrep', 'Microsoft.WindowsTerminal', 'Kitware.CMake', 'Microsoft.VCRedist.2015+.x64', - 'Git.Git' ) Write-Warning "About to install the following software:" @@ -241,15 +241,6 @@ foreach($pkg in $installs) { Start-Process -NoNewWindow -Wait winget -ArgumentList 'install',$pkg } -$gitPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$env:APPDATA\..\Local\Programs\Git\cmd") - -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'" -} 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") -} $winlibsPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$env:APPDATA\..\Local\Programs\WinLibs") @@ -282,3 +273,21 @@ if($env:PATH.contains($winlibsPath)) { $newPath = $Env:PATH + ";$winlibsPath\mingw64\bin" [Environment]::SetEnvironmentVariable("Path", $newPath, "User") } + +$gitPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$env:APPDATA\..\Local\Programs\Git\cmd") + +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'" +} 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 it later with: winget install git.git." + winget remove git.git + } +}