mirror of
https://github.com/actions/setup-dotnet.git
synced 2024-11-22 19:41:08 +07:00
33 lines
843 B
PowerShell
33 lines
843 B
PowerShell
$os = $args[0]
|
|
|
|
$linuxDotnetPaths = @("/usr/share/dotnet", "$env:HOME/.dotnet")
|
|
$macOSDotnetPaths = @("$env:HOME/.dotnet")
|
|
$windowsDotnetPaths = @("$env:LocalAppData\Microsoft\dotnet/*",
|
|
"$env:ProgramFiles\dotnet/*",
|
|
"$env:HOME\.dotnet")
|
|
|
|
$pathsToClear = @()
|
|
|
|
if ($os -eq "Linux") {
|
|
$pathsToClear = $linuxDotnetPaths
|
|
} elseif ($os -eq "macOS") {
|
|
$pathsToClear = $macOSDotnetPaths
|
|
} elseif ($os -eq "Windows") {
|
|
Write-Host $env:LocalAppData
|
|
$pathsToClear = $windowsDotnetPaths
|
|
}
|
|
|
|
foreach ($path in $pathsToClear) {
|
|
if (Test-Path $path) {
|
|
Write-Host "Clear $path path"
|
|
Remove-Item $path -Recurse -Force
|
|
}
|
|
}
|
|
|
|
try {
|
|
Get-Command "dotnet --info"
|
|
Write-Host "dotnet was not removed"
|
|
exit 1
|
|
} catch {
|
|
Write-Host "dotnet was removed successfully"
|
|
} |