fix(local-tool): Inno Setup 偵測加入 user-scope 安裝路徑
winget 7.x 的 Inno Setup 可能裝到 %LOCALAPPDATA%\Programs\Inno Setup 6\ 而非傳統的 Program Files (x86)。新增 user-scope 固定路徑 + HKCU 登錄檔 + %LOCALAPPDATA%\Programs 遞迴掃描三種偵測方式。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e6f7afe8db
commit
dbad729da3
@ -466,6 +466,8 @@ exe: wails-windows ## ⚠️ 必須在 Windows 上跑:Inno Setup → dist/visi
|
|||||||
else \
|
else \
|
||||||
for p in "/c/Program Files (x86)/Inno Setup 6/ISCC.exe" \
|
for p in "/c/Program Files (x86)/Inno Setup 6/ISCC.exe" \
|
||||||
"/c/Program Files/Inno Setup 6/ISCC.exe" \
|
"/c/Program Files/Inno Setup 6/ISCC.exe" \
|
||||||
|
"$$LOCALAPPDATA/Programs/Inno Setup 6/ISCC.exe" \
|
||||||
|
"$$USERPROFILE/AppData/Local/Programs/Inno Setup 6/ISCC.exe" \
|
||||||
"/c/Program Files (x86)/Inno Setup 5/ISCC.exe"; do \
|
"/c/Program Files (x86)/Inno Setup 5/ISCC.exe"; do \
|
||||||
if [ -f "$$p" ]; then ISCC_BIN="$$p"; break; fi; \
|
if [ -f "$$p" ]; then ISCC_BIN="$$p"; break; fi; \
|
||||||
done; \
|
done; \
|
||||||
|
|||||||
@ -107,31 +107,48 @@ $msysPython = Convert-ToMsysPath $realPython
|
|||||||
# 找 Inno Setup Compiler (ISCC.exe)
|
# 找 Inno Setup Compiler (ISCC.exe)
|
||||||
# 重要:檔名是 ISCC.exe(大寫),winget 裝在 Program Files (x86) 不在 PATH 裡
|
# 重要:檔名是 ISCC.exe(大寫),winget 裝在 Program Files (x86) 不在 PATH 裡
|
||||||
function Find-Iscc {
|
function Find-Iscc {
|
||||||
|
# 1. 固定路徑(system + user scope)
|
||||||
$candidates = @(
|
$candidates = @(
|
||||||
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
|
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
|
||||||
"$env:ProgramFiles\Inno Setup 6\ISCC.exe",
|
"$env:ProgramFiles\Inno Setup 6\ISCC.exe",
|
||||||
|
"$env:LOCALAPPDATA\Programs\Inno Setup 6\ISCC.exe",
|
||||||
|
"$env:USERPROFILE\AppData\Local\Programs\Inno Setup 6\ISCC.exe",
|
||||||
"${env:ProgramFiles(x86)}\Inno Setup 5\ISCC.exe"
|
"${env:ProgramFiles(x86)}\Inno Setup 5\ISCC.exe"
|
||||||
)
|
)
|
||||||
foreach ($p in $candidates) {
|
foreach ($p in $candidates) {
|
||||||
if ($p -and (Test-Path $p)) { return $p }
|
if ($p -and (Test-Path $p)) { return $p }
|
||||||
}
|
}
|
||||||
# 從登錄檔找 Inno Setup 的安裝路徑
|
# 2. 登錄檔 Uninstall key(HKLM + HKCU 都看)
|
||||||
$regPaths = @(
|
$regPaths = @(
|
||||||
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1',
|
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1',
|
||||||
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1'
|
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1',
|
||||||
|
'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1'
|
||||||
)
|
)
|
||||||
foreach ($rp in $regPaths) {
|
foreach ($rp in $regPaths) {
|
||||||
$item = Get-ItemProperty $rp -ErrorAction SilentlyContinue
|
$item = Get-ItemProperty $rp -ErrorAction SilentlyContinue
|
||||||
if ($item -and $item.InstallLocation) {
|
if ($item) {
|
||||||
$p = Join-Path $item.InstallLocation 'ISCC.exe'
|
if ($item.InstallLocation) {
|
||||||
if (Test-Path $p) { return $p }
|
$p = Join-Path $item.InstallLocation 'ISCC.exe'
|
||||||
|
if (Test-Path $p) { return $p }
|
||||||
|
}
|
||||||
|
if ($item.'Inno Setup: App Path') {
|
||||||
|
$p = Join-Path $item.'Inno Setup: App Path' 'ISCC.exe'
|
||||||
|
if (Test-Path $p) { return $p }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# 最後備案:掃 Program Files 底下
|
# 3. 遞迴掃 Program Files + user AppData
|
||||||
$found = Get-ChildItem -Path "${env:ProgramFiles(x86)}","$env:ProgramFiles" `
|
$scanRoots = @(
|
||||||
-Filter 'ISCC.exe' -Recurse -ErrorAction SilentlyContinue -Force |
|
"${env:ProgramFiles(x86)}",
|
||||||
Select-Object -First 1
|
"$env:ProgramFiles",
|
||||||
if ($found) { return $found.FullName }
|
"$env:LOCALAPPDATA\Programs"
|
||||||
|
) | Where-Object { $_ -and (Test-Path $_) }
|
||||||
|
foreach ($root in $scanRoots) {
|
||||||
|
$found = Get-ChildItem -Path $root -Filter 'ISCC.exe' -Recurse `
|
||||||
|
-ErrorAction SilentlyContinue -Force |
|
||||||
|
Select-Object -First 1
|
||||||
|
if ($found) { return $found.FullName }
|
||||||
|
}
|
||||||
return $null
|
return $null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user