Rework cleanup script
This commit is contained in:
parent
c1ca14bb7b
commit
c0d7255256
|
@ -1,21 +1,11 @@
|
||||||
$os = $args[0]
|
$dotnetPaths = @{
|
||||||
|
Linux = @("/usr/share/dotnet")
|
||||||
$linuxDotnetPaths = @("/usr/share/dotnet")
|
macOS = @("$env:HOME/.dotnet")
|
||||||
$macOSDotnetPaths = @("$env:HOME/.dotnet")
|
Windows = @("$env:ProgramFiles\dotnet/*",
|
||||||
$windowsDotnetPaths = @("$env:ProgramFiles\dotnet/*",
|
|
||||||
"$env:LocalAppData\Microsoft\dotnet/*")
|
"$env:LocalAppData\Microsoft\dotnet/*")
|
||||||
|
|
||||||
$pathsToClear = @()
|
|
||||||
|
|
||||||
if ($os -eq "Linux") {
|
|
||||||
$pathsToClear = $linuxDotnetPaths
|
|
||||||
} elseif ($os -eq "macOS") {
|
|
||||||
$pathsToClear = $macOSDotnetPaths
|
|
||||||
} elseif ($os -eq "Windows") {
|
|
||||||
$pathsToClear = $windowsDotnetPaths
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($path in $pathsToClear) {
|
foreach ($path in $dotnetPaths[$args[0]]) {
|
||||||
if (Test-Path $path) {
|
if (Test-Path $path) {
|
||||||
Write-Host "Clear $path path"
|
Write-Host "Clear $path path"
|
||||||
Remove-Item $path -Recurse -Force
|
Remove-Item $path -Recurse -Force
|
||||||
|
|
Loading…
Reference in New Issue