I am installing the Apache through the Inno Setup. Now I want to copy the httpd.conf
file from my local disk to Apache conf
folder after the Apache installation.
How can I achieve this using Inno Setup?
Asked
Active
Viewed 6,173 times
4

Martin Prikryl
- 188,800
- 56
- 490
- 992

SSS
- 683
- 1
- 6
- 16
-
2If Apache is a prerequisite of your app you might want to consider using `PrepareToInstall` to install it instead of `[Run]` (see the example script). It's a little more work but you get a lot more control over things. – Miral Sep 29 '12 at 07:57
-
Related question: [Overwrite installed files with files in setup subfolder in Inno Setup](https://stackoverflow.com/q/65161551/850848). – Martin Prikryl Dec 09 '20 at 06:50
2 Answers
3
you can use my code to copy your httpd.conf file to Apache conf folder,try it:)
procedure CurStepChanged(CurStep: TSetupStep);
if CurStep = ssDone then
begin
//copy your httpd.conf file from your localdisk to Apache conf folder
FileCopy('/you/path/httpd.conf','/apache/conf/httpd.conf',False);
end;

LEo
- 442
- 5
- 21
-
1Though this will work, the `ssDone` step is the very last step of the setup and that is unecessarily late. Better use `ssPostInstall` step. But this will better be executed from the `PrepareToInstall` event where you run the Apache setup and after that copy the file. Also keep in mind that not everything has to be executed from a `[Code]` section event method. OP e.g. mentioned using `[Run]` section and for that you would better write an `AfterInstall` parameter function. Btw. you're having typo in your code (missing comma) ;-) – TLama Jul 23 '14 at 14:29
3
I solved this issue by using the AfterInstall
parameter in [Run]
section. It works fine.

Martin Prikryl
- 188,800
- 56
- 490
- 992

SSS
- 683
- 1
- 6
- 16