setup-dotnet/__tests__/clear-toolcache.ps1

26 lines
604 B
PowerShell
Raw Normal View History

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