Improve tools setup

Log full semver of tools installed with composer

Refactor adding paths to PATH
This commit is contained in:
Shivam Mathur
2022-01-11 06:04:19 +05:30
parent b7cdb2373c
commit f3010adf3e
5 changed files with 90 additions and 55 deletions

View File

@ -64,10 +64,17 @@ Function Add-Path {
param(
[string]$PathItem
)
$newPath = (Get-ItemProperty -Path 'hkcu:\Environment' -Name PATH).Path.replace("$PathItem;", '')
$newPath = $PathItem + ';' + $newPath
Set-ItemProperty -Path 'hkcu:\Environment' -Name Path -Value $newPath
Get-PathFromRegistry
if(-not(Test-Path $PathItem) -or "$env:PATH;".contains("$PathItem;")) {
return
}
if ($env:GITHUB_PATH) {
Add-Content $PathItem -Path $env:GITHUB_PATH -Encoding utf8
} else {
$newPath = (Get-ItemProperty -Path 'hkcu:\Environment' -Name PATH).Path.replace("$PathItem;", '')
$newPath = $PathItem + ';' + $newPath
Set-ItemProperty -Path 'hkcu:\Environment' -Name Path -Value $newPath
Get-PathFromRegistry
}
}
# Function to make sure printf is in PATH.