首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >InnoSetup为install.log制作{app} dir

InnoSetup为install.log制作{app} dir
EN

Stack Overflow用户
提问于 2014-07-07 16:33:12
回答 1查看 172关注 0票数 2

我需要在安装目标文件夹({app})中创建所选组件的install.log,但是当我运行该安装程序时遇到了问题,该安装程序说:“文件不存在C:/tmp/exe/install.log”,我假设这意味着它还没有创建dir "exe“。我怎么才能避开这一切?

代码语言:javascript
复制
procedure CurStepChanged(CurStep: TSetupStep);
var
  I: Integer;
  LogList: TStringList;
begin
  if CurStep = ssInstall then
  begin
    LogList := TStringList.Create;
    try
      LogList.Add('Selected components:');
      for I := 0 to WizardForm.ComponentsList.Items.Count - 1 do
        if WizardForm.ComponentsList.Checked[I] then
          LogList.Add('Component: ' + WizardForm.ComponentsList.ItemCaption[I]);

      LogList.SaveToFile(ExpandConstant('{app}\install.log'));
    finally
      LogList.Free;
    end;
  end;
end;
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-07-07 17:11:47

我怀疑在创建文件夹之前,您正在试图在这个过程的早期访问该文件夹。

尝试更改为流程中的稍后步骤,例如ssPostInstall。此时,您将确切地知道该文件夹已被创建。您的其余代码应该能够保持不变。

代码语言:javascript
复制
procedure CurStepChanged(CurStep: TSetupStep);
var
  I: Integer;
  LogList: TStringList;
begin
  if CurStep = ssPostInstall then
  begin
    LogList := TStringList.Create;
    try
      LogList.Add('Selected components:');
      for I := 0 to WizardForm.ComponentsList.Items.Count - 1 do
        if WizardForm.ComponentsList.Checked[I] then
          LogList.Add('Component: ' + WizardForm.ComponentsList.ItemCaption[I]);

      LogList.SaveToFile(ExpandConstant('{app}\install.log'));
    finally
      LogList.Free;
    end;
  end;
end;
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24615477

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档