diff options
Diffstat (limited to 'website')
| -rw-r--r-- | website/install.ps1 | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/website/install.ps1 b/website/install.ps1 index 66f9a8c9..ccf08239 100644 --- a/website/install.ps1 +++ b/website/install.ps1 @@ -213,14 +213,14 @@ function Set-ManagedJunction { if ($existingTarget.Equals($TargetPath, [System.StringComparison]::OrdinalIgnoreCase)) { return } - Remove-Item -LiteralPath $LinkPath -Force + Remove-Item -LiteralPath $LinkPath -Recurse -Force } elseif ($item.PSIsContainer) { if ((Get-ChildItem -LiteralPath $LinkPath -Force | Select-Object -First 1) -ne $null) { if (-not (Move-LegacyHerdrBinDirectory -Path $LinkPath -AllowMigration $AllowLegacyHerdrBinMigration)) { throw "Refusing to replace non-empty directory at $LinkPath with a junction." } } else { - Remove-Item -LiteralPath $LinkPath -Force + Remove-Item -LiteralPath $LinkPath -Recurse -Force } } else { throw "Refusing to replace file at $LinkPath with a junction." @@ -242,7 +242,11 @@ function Move-LegacyHerdrBinDirectory { } $entries = @(Get-ChildItem -LiteralPath $Path -Force) - if ($entries.Count -ne 1 -or $entries[0].PSIsContainer -or $entries[0].Name -ine "herdr.exe") { + if (($entries | Where-Object { $_.PSIsContainer } | Select-Object -First 1) -ne $null) { + return $false + } + + if (($entries | Where-Object { $_.Name -ieq "herdr.exe" } | Select-Object -First 1) -eq $null) { return $false } |
