I have a question, I looked around the internet and I didn't get help. This is the problem: - I want to save the Application path location in a XML Node. The problem is that I can't use the consts names for directories because the installer write any word I put there, exactly as how I wrote it.
function NextButtonClick2(CurPageID: Integer): Boolean;
begin
Result := True;
SaveValueToXML(ExpandConstant('{pf}\XXX\Config.xml'), '//@param', PEdit.Text);
SaveValueToXML(ExpandConstant('{pf}\XXX\Config.xml'), '//@path', '{app}\XXX\Aplication.exe');
end;
This is the result I get
<?xml version="1.0" encoding="UTF-8"?>
-<games> <game priority="0" display="1" param="test" path="{app}\Aplication.exe" id="1036"/> </games>
This is the result I expect:
<?xml version="1.0" encoding="UTF-8"?>
-<games> <game priority="0" display="1" param="test" path="C:\Program Files (x86)\XXX\Aplication.exe" id="1036"/> </games>
The location is properly... but only if I write it manually. And that's a problem, the installer gonna edit the path node from the XML in an automatically way... then if the users have a different hard drive letter [C,D,F,H, etc] or a different path location for the main application, the will get errors during the installation.
Please help! Thanks from now on!
You are not calling the ExpandConstant function for the value you want to store, just for the name of the XML.
Change your code to:
function NextButtonClick2(CurPageID: Integer): Boolean;
begin
Result := True;
SaveValueToXML(ExpandConstant('{pf}\XXX\Config.xml'), '//@param', PEdit.Text);
SaveValueToXML(ExpandConstant('{pf}\XXX\Config.xml'), '//@path',
ExpandConstant('{app}\XXX\Aplication.exe'));
end;
And you'll get what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With