wraithdu
26th November 2007 21:31 UTC
Double variable expansion
Is there a way to make NSIS do double variable expansions? I'm trying to set some environment variables that are read from an INI file. The values in the INI file reference variables set in the launcher. For ex the INI has sections like -
[1]
name=TCDrive
value=$MEDIAROOT
The var $MEDIAROOT is derived in the launcher. The name and value are read from the INI into $R0 and $R1, and the System call uses "$R0" and "$R1". What I get is an environment variable like (type set at command prompt) -
TCDrive=$MEDIAROOT
So how can I get NSIS to do the double expansion so I get the correct env var?
kichik
26th November 2007 23:24 UTC
You'll have to manually implement that as all of the expansion is done in the compiler at build time and the installer itself doesn't know how to expand them. The installer itself isn't even aware the variables have names.
wraithdu
27th November 2007 01:43 UTC
Do you have any tips on how I should go about doing that? I've got no idea. Also, how is that possible that all expansion is done at compile time? Any of the contstants must be expanded at runtime as they change from system to system and based on the current script directory.
Anyways, I can't figure out how to accomplish what I want. Reading from the INI seems to cause the problem.
kichik
27th November 2007 17:59 UTC
You can use the WordReplace function.
The variables aren't actually expanded at compile-time. That was wrong term usage on my end. But they are stripped of their names and assigned a number, so the installer doesn't know of names at all.
wraithdu
28th November 2007 05:55 UTC
Thanks! My brain just needed a kick in the right direction. Works like a charm now :)