From ddae3eb61c145ea7f09173e531f872c116062351 Mon Sep 17 00:00:00 2001 From: JoeAllen <2494136784@qq.com> Date: Tue, 29 Sep 2026 17:39:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=91=E5=B8=83=E8=84=9A=E6=9C=AC=207?= =?UTF-8?q?z=20=E6=8E=A2=E6=B5=8B=E8=A6=86=E7=9B=96=20D=20=E7=9B=98?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E4=B8=8E=E6=B3=A8=E5=86=8C=E8=A1=A8=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/publish-gitea.ps1 | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/publish-gitea.ps1 b/scripts/publish-gitea.ps1 index 22dfae2..ac56ee3 100644 --- a/scripts/publish-gitea.ps1 +++ b/scripts/publish-gitea.ps1 @@ -240,9 +240,22 @@ foreach ($f in $Files) { # ── 7z 压缩附件(OTA 主通道:体积小、下载快)── # 内部文件名 = $asset(应用解压后按此名暂存安装) - $SevenZip = @("$env:ProgramFiles\7-Zip\7z.exe", "${env:ProgramFiles(x86)}\7-Zip\7z.exe") | - Where-Object { Test-Path $_ } | Select-Object -First 1 - if (-not $SevenZip) { $SevenZip = (Get-Command 7z -ErrorAction SilentlyContinue).Source } + $SevenZip = @( + "$env:ProgramFiles\7-Zip\7z.exe", + "${env:ProgramFiles(x86)}\7-Zip\7z.exe", + "D:\Program Files\7-Zip\7z.exe", + "C:\Program Files (x86)\7-Zip\7z.exe" + ) | Where-Object { Test-Path $_ } | Select-Object -First 1 + if (-not $SevenZip) { + $SevenZip = (Get-Command 7z -ErrorAction SilentlyContinue).Source + } + if (-not $SevenZip) { + # 官方安装器写入注册表(Path 指向安装目录) + try { + $reg = Get-ItemProperty "HKLM:\SOFTWARE\7-Zip" -ErrorAction Stop + if ($reg.Path) { $cand = Join-Path $reg.Path "7z.exe"; if (Test-Path $cand) { $SevenZip = $cand } } + } catch { } + } if ($SevenZip) { $packDir = Join-Path $env:TEMP ("mqttx-pack-" + [guid]::NewGuid().ToString("N")) New-Item -ItemType Directory -Path $packDir | Out-Null