Skip to content

Commit

Permalink
feat: PATH fix to add raw git path for Unity Package Manager Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
guitarrapc committed Jul 9, 2021
1 parent 54e537f commit 74fcd03
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions etc/windows/add-gitpath.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$gitCmdPath = "${env:USERPROFILE}\scoop\apps\git\current\cmd"
$userPath = [Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User)
# git path exists?
if (-not (Test-Path "${env:USERPROFILE}\scoop\shims\git.exe")) {
Write-Output "git not found in scoop PATH. Please run ``scoop install git`` first."
} else {
# add scoop git raw path to 1st PATH index.
if ($userPath.Split(";") -notcontains "$gitCmdPath") {
$newUserPath = $gitCmdPath + ";" + $userPath
Write-Warning "git cmd not found in your PATH, let's replace to `"$newUserPath`". Old Path is $userPath"
[Environment]::SetEnvironmentVariable("PATH", $newUserPath, [EnvironmentVariableTarget]::User)
Write-Output "Complete. New PATH is $([Environment]::GetEnvironmentVariable("PATH", [EnvironmentVariableTarget]::User))"

} else {
Write-Output "git cmd is already in your PATH. $userPath"
}
}

0 comments on commit 74fcd03

Please sign in to comment.