فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(windows-vm): locate actual Rust app.exe and inspect NSIS registry when install location differs
davoodmehraban89 committed
Oct 16, 2026 at 18:09 UTC
ecd3ec65dca5097857ad4d0eaf1bf94743fb85a2
1 file changed
+29
-2
scripts/windows-vm-native-lab.ps1
+29
-2
@@ -45,9 +45,36 @@ function Install-NSIS([string]$installer,[string]$directory) {
45
}
46
if ($process.ExitCode -ne 0) { throw "NSIS installer exited $($process.ExitCode)" }
47
} finally { $process.Dispose() }
48
+ # The current Rust binary target is "app.exe" even though the product
49
+ # and NSIS installer are called Factor-easyPro. Check both explicitly.
50
$candidate = Get-ChildItem -LiteralPath $directory -Recurse -File -ErrorAction SilentlyContinue |
49
- Where-Object { $_.Name -eq 'Factor-easyPro.exe' } | Select-Object -First 1
50
- if (-not $candidate) { throw "Installed Factor-easyPro.exe not found in $directory" }
51
+ Where-Object { $_.Name -in @('app.exe', 'Factor-easyPro.exe') } | Select-Object -First 1
52
+ if (-not $candidate) {
53
+ $discovered = @(Get-ChildItem -LiteralPath $directory -Recurse -File -ErrorAction SilentlyContinue |
54
+ Select-Object -First 15 -ExpandProperty FullName)
55
+ Write-Output ("NSIS installation contents: " + ($discovered -join '; '))
56
+ $uninstallRoots = @(
57
+ 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall',
58
+ 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall',
59
+ 'HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
60
+ )
61
+ foreach ($registry in $uninstallRoots) {
62
+ if (!(Test-Path $registry)) { continue }
63
+ $entries = @(Get-ChildItem $registry -ErrorAction SilentlyContinue |
64
+ Get-ItemProperty -ErrorAction SilentlyContinue |
65
+ Where-Object { $_.DisplayName -like 'Factor-easyPro*' })
66
+ foreach ($entry in $entries) {
67
+ $place = $entry.InstallLocation
68
+ if (!$place -or !(Test-Path $place)) { continue }
69
+ $candidate = Get-ChildItem -LiteralPath $place -Recurse -File -ErrorAction SilentlyContinue |
70
+ Where-Object { $_.Name -in @('app.exe', 'Factor-easyPro.exe') } |
71
+ Select-Object -First 1
72
+ if ($candidate) { break }
73
+ }
74
+ if ($candidate) { break }
75
+ }
76
+ }
77
+ if (-not $candidate) { throw "Installed native app executable not found in $directory or uninstall registry" }
78
if ($candidate.Length -lt 300000) { throw 'Installed executable suspiciously small' }
79
return $candidate.FullName
80
}