我有一个像魅力一样工作的 INNO 安装程序。现在我需要添加一个主题选项预安装,以便用户为应用程序选择主题。这些主题在部署目录中定义,该目录在安装时被复制到 {tmp} 文件夹。
我要做的是在此目录部分中查找特定目录/文件以确定主题选项。当我找到一个主题时,我会在组合框中添加一个选项供用户选择。然后,此选择将影响应用程序的安装(也来自 {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;