Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inno Setup Compiler: How to edit INI file and replace a value with {app} constant

Tags:

inno-setup

I have a INI file which contains c:/wamp many times.

How can I replace this text with the {app} extended/chosen constant value?

I know now how to replace a single value:

[INI]
Filename: "{app}\wampmanager.conf"; Section: "main"; Key: "installDir"; String: """{app}"""

I am reading from here

like image 759
Ionut Flavius Pogacian Avatar asked Mar 22 '23 02:03

Ionut Flavius Pogacian


1 Answers

This is risky solution as TLama says.

You have to call this procedure at some point, e.g. on ssDone or as an AfterInstall

[Code]
procedure Update;
var
A: AnsiString;
U: String;
begin
    LoadStringFromFile(ExpandConstant('{app}\wampmanager.conf'), A);
    U := A;
    StringChange(U, 'c:/wamp', ExpandConstant('{app}'));
    A := U;
    SaveStringToFile(ExpandConstant('{app}\wampmanager.conf'), A, False);
end;
like image 199
RobeN Avatar answered Apr 27 '23 12:04

RobeN