我有一个INNO安装程序,它像一个魅力一样工作。现在我需要为用户预先安装主题选项以选择应用程序的主题。这些主题是在安装时复制到{tmp}文件夹的部署目录中定义的。INNO安装程序在安装前开始安装时提取目录树
我想要做的是在这个目录部分查找特定的目录/文件来确定主题选项。当我找到一个主题时,我会将一个选项添加到组合框供用户选择。此选择将影响应用程序的安装(也来自{tmp}区域)。
我的问题是,直到点击安装按钮,文件才会被提取到{tmp}目录。有没有办法在安装之前查看压缩文件结构或强制这些文件到{tmp}目录?文件结构对于每个主题都是不同的,并且基于客户只有某些主题可用。
我以前使用过ExtractTemporaryFile方法,但我不知道在运行时存在哪些主题,直到解压目录为止。能够提取整个目录树会很好,但我找不到一个简单的方法来完成此操作。
感谢您的帮助。
下面是什么,我本来想做一个示例脚本:
[Setup]
AppName=Test
AppVersion=1.5
DefaultDirName={pf}\test
OutputDir=Output
OutputBaseFilename=tt
DisableReadyPage=false
[Files]
;;Source: readme.txt; DestDir: {tmp}\App\deploy\themes\theme1; Flags: ignoreversion replacesameversion
;;Source: readme.txt; DestDir: {tmp}\App\deploy\themes\theme2; Flags: ignoreversion replacesameversion
;;Source: readme.txt; DestDir: {tmp}\App\deploy\themes\theme3; Flags: ignoreversion replacesameversion
;;Source: readme.txt; DestDir: {tmp}\App\deploy\themes\theme4; Flags: ignoreversion replacesameversion
Source: App\*.*; DestDir: {tmp}\App; Flags: ignoreversion replacesameversion recursesubdirs createallsubdirs
Source: readme.txt; DestDir: {app}; Flags: ignoreversion replacesameversion
[Run]
[Code]
var
curDir : String;
TestPage : TWizardPage;
ThemeComboBox: TNewComboBox;
procedure InitializeWizard;
begin
TestPage := CreateCustomPage(wpSelectTasks, 'My test page', 'run test');
// create the theme combo box
ThemeComboBox := TNewComboBox.Create(TestPage);
ThemeComboBox.Name := 'themeselection';
ThemeComboBox.Width := TestPage.SurfaceWidth;
ThemeComboBox.Parent := TestPage.Surface;
ThemeComboBox.Style := csDropDownList;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
ThemeDir: String;
begin
Result := True;
if CurPageID = wpSelectDir then
begin
// look for the networks and then add the ones that exist to the combo box
ThemeDir := ExpandConstant('{tmp}\App\deploy\themes\tmeme1');
MsgBox(ThemeDir, mbInformation, MB_OK);
if DirExists(ThemeDir) then
begin
// populate the combo box
// this is theme1 so it is Standard
ThemeComboBox.Items.Add('Standard');
end;
ThemeDir := ExpandConstant('{tmp}\App\deploy\themes\theme2');
if DirExists(ThemeDir) then
begin
// populate the combo box
ThemeComboBox.Items.Add('theme2');
end;
ThemeDir := ExpandConstant('{tmp}\App\deploy\themes\theme3');
if DirExists(ThemeDir) then
begin
// populate the combo box
ThemeComboBox.Items.Add('theme3');
end;
ThemeDir := ExpandConstant('{tmp}\App\deploy\themes\theme4');
if DirExists(ThemeDir) then
begin
// populate the combo box
ThemeComboBox.Items.Add('theme4');
end;
end;
end;
你能举个例子吗?我不确定我是否知道你在说什么。谢谢。 – 2012-03-05 13:11:19
Steve,添加了一个例子(相当晚了:-) @Deanna,我认为从InnoSetup预处理器输出的东西不会输出到运行时输出(*输出直接输入到一个pascal数组*)。常量数组不受支持。 – TLama 2012-07-30 00:11:55
@TLama正如你已经证明的那样,它可以输出代码来填充数组,虽然:) – Deanna 2012-07-30 08:49:23