fix(client/windows): installer 覆盖修复 — 装新版前静默卸载遗留 AppId 的 1.0.0
1.0.0 的 AppId 是非法 GUID(...PANGOLIN0001),1.0.1 起改成合法 GUID。 AppId 不同 → Inno 视为两个独立产品 → 控制面板里 1.00/1.01 并排不覆盖。 当前 AppId 已稳定会原地升级;再在 ssInstall 前把遗留 AppId 的残留装 静默卸掉(/VERYSILENT),清掉已并存的 1.0.0 幽灵。版本 bump 1.0.2→1.0.3。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
; 前置: 先在 client/ 跑 `flutter build windows`(Release),产物在
|
; 前置: 先在 client/ 跑 `flutter build windows`(Release),产物在
|
||||||
; ..\..\build\windows\x64\runner\Release
|
; ..\..\build\windows\x64\runner\Release
|
||||||
#define MyAppName "穿山甲 Pangolin"
|
#define MyAppName "穿山甲 Pangolin"
|
||||||
#define MyAppVersion "1.0.2"
|
#define MyAppVersion "1.0.3"
|
||||||
#define MyAppPublisher "Pangolin"
|
#define MyAppPublisher "Pangolin"
|
||||||
#define MyAppExeName "pangolin_vpn.exe"
|
#define MyAppExeName "pangolin_vpn.exe"
|
||||||
#define BuildDir "..\..\build\windows\x64\runner\Release"
|
#define BuildDir "..\..\build\windows\x64\runner\Release"
|
||||||
@@ -47,3 +47,42 @@ Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#MyAppName}}
|
|||||||
[UninstallDelete]
|
[UninstallDelete]
|
||||||
; 卸载清理运行期数据(kernel 配置等)
|
; 卸载清理运行期数据(kernel 配置等)
|
||||||
Type: filesandordirs; Name: "{localappdata}\Pangolin"
|
Type: filesandordirs; Name: "{localappdata}\Pangolin"
|
||||||
|
|
||||||
|
[Code]
|
||||||
|
{ ── 升级覆盖修复 ──────────────────────────────────────────────────────────
|
||||||
|
历史坑:1.0.0 的 AppId 是非法 GUID(...PANGOLIN0001),1.0.1 起改成当前合法
|
||||||
|
GUID。AppId 不同 → Inno 视为两个独立产品 → 旧版不被覆盖,控制面板里并排两个。
|
||||||
|
当前 AppId 已稳定(1.0.1+ 同源,会原地升级);此处在安装前再把那个遗留 AppId
|
||||||
|
的残留装静默卸掉,清掉已并存的 1.0.0 幽灵,杜绝多版本并排。}
|
||||||
|
const
|
||||||
|
LegacyAppId = '{B2F1B0A0-7A3C-4C2E-9E5A-PANGOLIN0001}_is1';
|
||||||
|
|
||||||
|
function GetUninstallString(const SubKey: string): string;
|
||||||
|
var
|
||||||
|
s: string;
|
||||||
|
begin
|
||||||
|
s := '';
|
||||||
|
if not RegQueryStringValue(HKLM64, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + SubKey, 'UninstallString', s) then
|
||||||
|
if not RegQueryStringValue(HKLM32, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + SubKey, 'UninstallString', s) then
|
||||||
|
RegQueryStringValue(HKCU, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + SubKey, 'UninstallString', s);
|
||||||
|
Result := s;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure RemoveLegacyVersion;
|
||||||
|
var
|
||||||
|
uninst: string;
|
||||||
|
rc: Integer;
|
||||||
|
begin
|
||||||
|
uninst := GetUninstallString(LegacyAppId);
|
||||||
|
if uninst <> '' then
|
||||||
|
begin
|
||||||
|
uninst := RemoveQuotes(uninst);
|
||||||
|
Exec(uninst, '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART', '', SW_HIDE, ewWaitUntilTerminated, rc);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CurStepChanged(CurStep: TSetupStep);
|
||||||
|
begin
|
||||||
|
if CurStep = ssInstall then
|
||||||
|
RemoveLegacyVersion;
|
||||||
|
end;
|
||||||
|
|||||||
Reference in New Issue
Block a user