setup-dotnet/__tests__/clear-toolcache.ps1

26 lines
604 B
PowerShell
Raw Normal View History

2021-02-03 11:56:08 +00:00
Write-Host $args[0]
2021-02-03 12:13:32 +00:00
$os = $args[0]
$linuxDotnetPaths = @("/usr/share/dotnet")
$macOSDotnetPaths = @("/Users/runner/.dotnet")
$windowsDotnetPaths = @("$env:LocalAppData\Microsoft\dotnet/*", "$env:ProgramFiles\dotnet/*")
$pathsToClear = @()
2021-02-03 12:17:48 +00:00
if ($os -eq "Linux") {
2021-02-03 12:13:32 +00:00
$pathsToClear = $linuxDotnetPaths
2021-02-03 12:15:56 +00:00
} elseif ($os -eq "macOS") {
2021-02-03 12:13:32 +00:00
$pathsToClear = $macOSDotnetPaths
2021-02-03 12:17:48 +00:00
} elseif ($os -eq "Windows") {
2021-02-03 12:13:32 +00:00
$pathsToClear = $windowsDotnetPaths
}
foreach ($path in $pathsToClear) {
if (Test-Path $path) {
Write-Host "Clear $path"
Remove-Item $path -Recurse -Force
}
}
2021-02-03 11:56:08 +00:00
dotnet --info