diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-06-13 14:13:06 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-06-13 14:13:06 +0200 |
| commit | d3b926f1536714c6da62a87bb66a6e1b6eaf37aa (patch) | |
| tree | 9c138dbdf86a6584c4fbf01dcfd435b704e9069c /.config/powershell | |
| parent | 79ebca9d6e957815899d894cf8955335b6e9441f (diff) | |
| download | dotfiles-d3b926f1536714c6da62a87bb66a6e1b6eaf37aa.tar.gz dotfiles-d3b926f1536714c6da62a87bb66a6e1b6eaf37aa.zip | |
Testing
Diffstat (limited to '.config/powershell')
| -rw-r--r-- | .config/powershell/bootstrap.ps1 | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/.config/powershell/bootstrap.ps1 b/.config/powershell/bootstrap.ps1 index 7f2f3d9..73d53b5 100644 --- a/.config/powershell/bootstrap.ps1 +++ b/.config/powershell/bootstrap.ps1 @@ -37,8 +37,7 @@ if (-not (Test-IsAdmin)) { # Imports . $HOME\.config\powershell\initialize.ps1 -#. $HOME\.config\powershell\ownership.ps1 -#. $HOME\.config\powershell\bloatware.ps1 +. $HOME\.config\powershell\bloatware.ps1 # Configure PowerShell Write-Host "Configuring PowerShell" @@ -155,18 +154,19 @@ refreshenv # Add Git to PATH if it's installed via Chocolatey Write-Host "Checking for Git installation" -$gitPath = "C:\Program Files\Git\cmd" -if (-not (Get-Command git -ErrorAction SilentlyContinue)) { - if (Test-Path $gitPath) { - [System.Environment]::SetEnvironmentVariable("Path", "$env:Path;$gitPath", [System.EnvironmentVariableTarget]::Machine) - [System.Environment]::SetEnvironmentVariable("Path", "$env:Path;$gitPath", [System.EnvironmentVariableTarget]::User) - [System.Environment]::SetEnvironmentVariable("Path", "$env:Path;$gitPath", [System.EnvironmentVariableTarget]::Process) - Write-Host "Git path added to environment variables." +$gitBinPath = "C:\Program Files\Git\bin" +$gitCmdPath = "C:\Program Files\Git\cmd" +$gitPaths = @($gitBinPath, $gitCmdPath) + +foreach ($path in $gitPaths) { + if (Test-Path $path) { + Write-Host "Adding $path to PATH" + [System.Environment]::SetEnvironmentVariable("Path", "$env:Path;$path", [System.EnvironmentVariableTarget]::Machine) + [System.Environment]::SetEnvironmentVariable("Path", "$env:Path;$path", [System.EnvironmentVariableTarget]::User) + [System.Environment]::SetEnvironmentVariable("Path", "$env:Path;$path", [System.EnvironmentVariableTarget]::Process) } else { - handle_error "Git is not installed or not found in the default path." + Write-Host "$path does not exist." } -} else { - Write-Host "Git is already installed and available in PATH." } # Check if Git is installed @@ -174,7 +174,7 @@ Write-Host "Checking for Git installation" if (-not (Get-Command git -ErrorAction SilentlyContinue)) { handle_error "Git is not installed or not found in PATH after installation." } else { - Write-Host "Git is already installed." + Write-Host "Git is installed and available in PATH." } # Define the `config` alias in the current session |
