mirror of
https://github.com/actions/versions-package-tools.git
synced 2025-12-10 19:50:24 +00:00
added the function GetToolDirectory
This commit is contained in:
@@ -83,3 +83,28 @@ function IsNixPlatform {
|
|||||||
|
|
||||||
return ($Platform -match "macos") -or ($Platform -match "darwin") -or ($Platform -match "ubuntu") -or ($Platform -match "linux")
|
return ($Platform -match "macos") -or ($Platform -match "darwin") -or ($Platform -match "ubuntu") -or ($Platform -match "linux")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Get root directory of selected tool
|
||||||
|
#>
|
||||||
|
function GetToolDirectory {
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[String]$ToolName,
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[String]$Version,
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[String]$Architecture
|
||||||
|
)
|
||||||
|
$targetPath = $env:AGENT_TOOLSDIRECTORY
|
||||||
|
if ([string]::IsNullOrEmpty($targetPath)) {
|
||||||
|
# GitHub Windows images don't have `AGENT_TOOLSDIRECTORY` variable
|
||||||
|
$targetPath = $env:RUNNER_TOOL_CACHE
|
||||||
|
}
|
||||||
|
$ToolcachePath = Join-Path -Path $targetPath -ChildPath $ToolName
|
||||||
|
$ToolcacheVersionPath = Join-Path -Path $ToolcachePath -ChildPath $Version
|
||||||
|
$toolDirectory = Join-Path $ToolcacheVersionPath $Architecture
|
||||||
|
|
||||||
|
return $toolDirectory
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user