From d3b926f1536714c6da62a87bb66a6e1b6eaf37aa Mon Sep 17 00:00:00 2001 From: srdusr Date: Thu, 13 Jun 2024 14:13:06 +0200 Subject: Testing --- .config/powershell/bootstrap.ps1 | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to '.config') 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 -- cgit v1.2.3