如何使用在[Code]部分下载的文件,然后解压缩到[Run]部分,作为要安装的文件?
这是我的密码。问题是,我希望在下载完成后提取zip文件。我想我的密码里没有这个。因为当我输入这个时,我会得到一个错误:
在……下面
[Setup]
LicenseFile={tmp}\apache-tomcat-9.0.0.M13\LICENSE
InfoBeforeFile={tmp}\apache-tomcat-9.0.0.M13\NOTICE
InfoAfterFile={tmp}\apache-tomcat-9.0.0.M13\RELEASE-NOTES在……下面
[Files]
Source: "{tmp}\apache-tomcat-9.0.0.M13\bin\tomcat9.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\...\apache-tomcat-9.0.0.M13\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs我会得到像文件不存在这样的编译错误。
如何使用我下载并解压的文件作为许可和发布说明?
我不确定.zip文件是否是在我想要提取的阶段提取的。下面是基于这些问题编译的代码:
#include <idp.iss>
[Setup]
LicenseFile=C:\..\Desktop\x64\apache-tomcat-9.0.0.M13\LICENSE
InfoBeforeFile=C:\...\x64\apache-tomcat-9.0.0.M13\NOTICE
InfoAfterFile=C:\...\x64\apache-tomcat-9.0.0.M13\RELEASE-NOTES
DisableWelcomePage=no
[Files]
Source: "C:\...\x64\apache-tomcat-9.0.0.M13\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "7za.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall;
[Code]
procedure InitializeWizard;
begin
idpAddFile('http://www-us.apache.org/dist/tomcat/tomcat-9/v9.0.0.M13/bin/apache-tomcat-9.0.0.M13-windows-x64.zip', ExpandConstant('{tmp}\apache-tomcat-9.0.0.M13-windows-x64.zip'));
idpDownloadAfter(wpWelcome);
end;
[Run]
Filename: {tmp}\7za.exe; Parameters: "x {tmp}\apache-tomcat-9.0.0.M13-windows-x64.zip -o{app}\ * -r -aoa"; Flags: runhidden runascurrentuser;发布于 2016-11-21 14:11:07
[Run]部分)。代码使用来自使用UnZip的How to get Inno Setup to unzip a file it installed (all as part of the one installation process)的Shell.Application函数。如果您希望使用外部解压缩应用程序,则可以使用Exec函数在调用UnZip的同一位置执行它。
#include "idp.iss"
[Setup]
DisableWelcomePage=no
LicenseFile=fake.txt
const
TomcatVersion = '9.0.0.M13';
var
TomcatZipPath: string;
procedure InitializeWizard();
var
TomcatZipUrl: string;
TomcatZipFile: string;
begin
TomcatZipFile := 'apache-tomcat-' + TomcatVersion + '-windows-x64.zip';
TomcatZipPath := ExpandConstant('{tmp}\' + TomcatZipFile);
TomcatZipUrl :=
'http://www-us.apache.org/dist/tomcat/tomcat-9/v' + TomcatVersion +
'/bin/' + TomcatZipFile;
idpAddFile(TomcatZipUrl, TomcatZipPath);
idpDownloadAfter(wpWelcome);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = IDPForm.Page.ID then
begin
idpShowDetails(False);
IDPForm.DetailsButton.Visible := False;
WizardForm.NextButton.Enabled := False;
WizardForm.BackButton.Visible := False;
WizardForm.CancelButton.Enabled := False;
try
IDPForm.TotalProgressLabel.Caption := 'Extracting files...';
UnZip(TomcatZipPath, ExpandConstant('{tmp}'));
finally
WizardForm.BackButton.Visible := True;
WizardForm.NextButton.Enabled := True;
WizardForm.CancelButton.Enabled := True;
end;
WizardForm.LicenseMemo.Lines.LoadFromFile(
ExpandConstant('{tmp}\apache-tomcat-9.0.0.M13\LICENSE'));
end;
Result := True;
end;



https://stackoverflow.com/questions/40718540
复制相似问题