2021-02-03 20:13:32 +08:00
|
|
|
$os = $args[0]
|
|
|
|
|
2021-02-03 20:31:11 +08:00
|
|
|
$linuxDotnetPaths = @("/usr/share/dotnet", "$env:HOME/.dotnet")
|
|
|
|
$macOSDotnetPaths = @("$env:HOME/.dotnet")
|
2021-02-03 22:03:23 +08:00
|
|
|
$windowsDotnetPaths = @("$env:HOME\.dotnet",
|
2021-02-03 20:31:11 +08:00
|
|
|
"$env:ProgramFiles\dotnet/*",
|
2021-02-03 22:03:23 +08:00
|
|
|
"$env:LocalAppData\Microsoft\dotnet/*")
|
2021-02-03 20:13:32 +08:00
|
|
|
|
|
|
|
$pathsToClear = @()
|
|
|
|
|
2021-02-03 20:17:48 +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:17:48 +08:00
|
|
|
} elseif ($os -eq "Windows") {
|
2021-02-03 20:13:32 +08:00
|
|
|
$pathsToClear = $windowsDotnetPaths
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($path in $pathsToClear) {
|
|
|
|
if (Test-Path $path) {
|
2021-02-03 20:20:22 +08:00
|
|
|
Write-Host "Clear $path path"
|
2021-02-03 22:13:32 +08:00
|
|
|
Remove-Item $path -Recurse -Force -ErrorAction SilentlyContinue
|
2021-02-03 20:13:32 +08:00
|
|
|
}
|
|
|
|
}
|