From 698eb51f543af47ba7a974d0d78f1bf0cca2cd53 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Tue, 9 Jun 2026 16:41:34 +0300 Subject: fix: migrate legacy windows bin backups --- website/install.ps1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'website') 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 } -- cgit v1.2.3