Install customized version of configuration file in Inno Setup after (Firebird) subinstaller finishes

你离开我真会死。 提交于 2021-01-24 11:54:48

问题


I'm trying to install Firebird 3 along with my application using Inno Setup and I need to distribute a customized version of firebird.conf file to replace the default that comes with Firebird. How to do that? Any options of the following would be enough:

  1. Copy Firebird.conf after Firebird is installed. (I'm not able to do that since the file added in [Files] section is always copied before running Firebird installation).

  2. Download sources for Firebird, add my firebird.conf there and create a new Firebird installer. (No idea where to get all the necessary files for this)


回答1:


One way to install a file after installation completes is by extracting it programmatically from CurStepChanged(ssPostInstall):

[Files]
Source: "Firebird.conf"; Flags: dontcopy

[Code]

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then
  begin
    Log('Installing Firebird.conf');
    ExtractTemporaryFile('Firebird.conf');
    if not FileCopy(ExpandConstant('{tmp}\Firebird.conf'),
                    ExpandConstant('{app}\Firebird.conf'), False) then
    begin
      RaiseException('Could not install Firebird.conf');
    end;
  end;
end;

For alternatives, see Overwrite installed files with files in setup subfolder in Inno Setup.



来源:https://stackoverflow.com/questions/51293403/install-customized-version-of-configuration-file-in-inno-setup-after-firebird

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!