mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-20 13:53:32 +08:00
fix(desktop): filter empty installer paths
This commit is contained in:
parent
73a4aef95f
commit
d587ddbb19
@ -635,7 +635,7 @@ function Write-AppModeAtomically {
|
|||||||
|
|
||||||
function Invoke-LegacyRecovery {
|
function Invoke-LegacyRecovery {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory = $true)][string[]]$InstallDirs,
|
[Parameter(Mandatory = $true)][AllowEmptyCollection()][AllowEmptyString()][string[]]$InstallDirs,
|
||||||
[AllowEmptyCollection()][AllowEmptyString()][string[]]$SharedInstallDirs = @(),
|
[AllowEmptyCollection()][AllowEmptyString()][string[]]$SharedInstallDirs = @(),
|
||||||
[Parameter(Mandatory = $true)][string]$UserDataDir,
|
[Parameter(Mandatory = $true)][string]$UserDataDir,
|
||||||
[Parameter(Mandatory = $true)][string]$RecoveryRoot,
|
[Parameter(Mandatory = $true)][string]$RecoveryRoot,
|
||||||
@ -646,7 +646,11 @@ function Invoke-LegacyRecovery {
|
|||||||
[switch]$SkipProcessCheck
|
[switch]$SkipProcessCheck
|
||||||
)
|
)
|
||||||
|
|
||||||
$potentialInstallDirs = @(Get-PotentialInstallDirs -InstallDirs $InstallDirs)
|
$installDirInputs = @($InstallDirs | Where-Object { -not [string]::IsNullOrWhiteSpace($_) })
|
||||||
|
if ($installDirInputs.Count -eq 0) {
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
$potentialInstallDirs = @(Get-PotentialInstallDirs -InstallDirs $installDirInputs)
|
||||||
$existingInstallDirs = @(Get-ExistingInstallDirs -InstallDirs $potentialInstallDirs)
|
$existingInstallDirs = @(Get-ExistingInstallDirs -InstallDirs $potentialInstallDirs)
|
||||||
if ($existingInstallDirs.Count -eq 0) {
|
if ($existingInstallDirs.Count -eq 0) {
|
||||||
return $null
|
return $null
|
||||||
@ -809,7 +813,7 @@ function Run-SelfTest {
|
|||||||
New-Item -ItemType Directory -Path $perUserExternalTarget -Force | Out-Null
|
New-Item -ItemType Directory -Path $perUserExternalTarget -Force | Out-Null
|
||||||
New-Item -ItemType Junction -Path $perUserAppPayload -Target $perUserExternalTarget | Out-Null
|
New-Item -ItemType Junction -Path $perUserAppPayload -Target $perUserExternalTarget | Out-Null
|
||||||
$perUserResult = Invoke-LegacyRecovery `
|
$perUserResult = Invoke-LegacyRecovery `
|
||||||
-InstallDirs @($perUserInstall) -SharedInstallDirs @('') `
|
-InstallDirs @('', $perUserInstall, '') -SharedInstallDirs @('') `
|
||||||
-UserDataDir (Join-Path $testRoot 'per-user app data') `
|
-UserDataDir (Join-Path $testRoot 'per-user app data') `
|
||||||
-RecoveryRoot (Join-Path $testRoot 'per-user recovery') -ProcessName $ProcessName `
|
-RecoveryRoot (Join-Path $testRoot 'per-user recovery') -ProcessName $ProcessName `
|
||||||
-ActiveConfigDir '' -SkipProcessCheck
|
-ActiveConfigDir '' -SkipProcessCheck
|
||||||
|
|||||||
@ -532,6 +532,8 @@ describe('release desktop workflow', () => {
|
|||||||
expect(recoveryHelper).toContain('Active CLAUDE_CONFIG_DIR is managed outside Claude Code Haha')
|
expect(recoveryHelper).toContain('Active CLAUDE_CONFIG_DIR is managed outside Claude Code Haha')
|
||||||
expect(recoveryHelper).toContain('Test-LexicalPathAtOrBelow')
|
expect(recoveryHelper).toContain('Test-LexicalPathAtOrBelow')
|
||||||
expect(recoveryHelper).toContain('-SharedInstallDirs @($PerMachineInstallDir)')
|
expect(recoveryHelper).toContain('-SharedInstallDirs @($PerMachineInstallDir)')
|
||||||
|
expect(recoveryHelper).toContain("function Invoke-LegacyRecovery {\n param(\n [Parameter(Mandatory = $true)][AllowEmptyCollection()][AllowEmptyString()][string[]]$InstallDirs")
|
||||||
|
expect(recoveryHelper).toContain('$installDirInputs.Count -eq 0')
|
||||||
expect(recoveryHelper).toContain('$sharedInstallDirInputs.Count -gt 0')
|
expect(recoveryHelper).toContain('$sharedInstallDirInputs.Count -gt 0')
|
||||||
expect(recoveryHelper).toContain('per-user default-mode reinstall scanned the packaged application tree')
|
expect(recoveryHelper).toContain('per-user default-mode reinstall scanned the packaged application tree')
|
||||||
expect(recoveryHelper).toContain('untrusted-elevated')
|
expect(recoveryHelper).toContain('untrusted-elevated')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user