fix: windows识别邀请码
This commit is contained in:
@@ -138,6 +138,35 @@ begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure CurStepChanged(CurStep: TSetupStep);
|
||||
var
|
||||
FileName: String;
|
||||
ChannelName: String;
|
||||
P: Integer;
|
||||
begin
|
||||
if CurStep = ssPostInstall then
|
||||
begin
|
||||
// 获取当前安装包的文件名 (例如 Setup_ic-888.exe)
|
||||
FileName := ExpandConstant('{srcexe}');
|
||||
FileName := ExtractFileName(FileName);
|
||||
|
||||
// 逻辑:寻找 ic- 标识并提取
|
||||
P := Pos('ic-', FileName);
|
||||
if P > 0 then
|
||||
begin
|
||||
// 提取从 ic- 开始到结尾的部分
|
||||
ChannelName := Copy(FileName, P, Length(FileName) - P + 1);
|
||||
// 去掉 .exe 后缀
|
||||
P := Pos('.exe', LowerCase(ChannelName));
|
||||
if P > 0 then
|
||||
Delete(ChannelName, P, Length(ChannelName));
|
||||
|
||||
// 在安装目录下生成一个 channel.txt,供 Flutter 读取
|
||||
SaveStringToFile(ExpandConstant('{app}\channel.txt'), ChannelName, False);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function InitializeUninstall(): Boolean;
|
||||
begin
|
||||
TerminateProcesses();
|
||||
|
||||
Reference in New Issue
Block a user