我尝试解压缩从我的存储库下载的安装文件。我找到了这个代码:
How to get Inno Setup to unzip a file it installed (all as part of the one installation process)
但我需要在用户的自定义页面中输入关于应用程序版本的存储库,下载并尝试解压缩。如何从输入发送到ExtractMe('{tmp}\INPUT FROM USER VERSION.zip', '{app}\');
begin
{Page for input Version}
UserPage := CreateInputQueryPage(wpWelcome,
'Number of Version', 'example : 1.8.20',
'Program will download your input');
UserPage.Add('Version:', False);
UserPage.Values[0] := GetPreviousData('Version', '1.8.20');
end;
{Called when the user clicks the Next button}
function NextButtonClick(CurPageID: Integer): Boolean;
var
Version: string;
FileURL: string;
begin
if CurPageID = wpReady then
begin
Version := UserPage.Values[0];
{Download}
FileURL := Format('http://127.0.0.1/repository/ia/ats-apps/ia-client.zip/%s/ia-client.zip-%0:s.zip', [Version]); <-- FROM HERE TO BELOW
idpAddFile(FileURL, ExpandConstant(Format('{tmp}\%s.zip', [Version])));
idpDownloadAfter(wpReady);
end;
Result := True;
end;
procedure unzip(src, target: AnsiString);
external 'unzip@files:unzipper.dll stdcall delayload';
procedure ExtractMe(src, target : AnsiString);
begin
unzip(ExpandConstant(src), ExpandConstant(target));
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
ExtractMe('{tmp}\INPUT FROM USER VERSION.zip', '{app}\'); <--HERE
end;
end;
感谢小费。
答案 0 :(得分:0)
与您在NextButtonClick
中使用的方式相同:阅读UserPage.Values[0]
。
ExtractMe(Format('{tmp}\%s.zip', [UserPage.Values[0]]), '{app}\');