stevie
4th September 2003 09:49 UTC
Can I use environment variables within "File" lines?
Hi there!
I'd like to build installer binaries containing files from a directory I pick via env variables. Unfortunately, makensis doesn't seem to accept variables in "Files" commands. Using
; ...
ReadEnvStr $0 ACE_ROOT
File $0\bin\aced.dll
; ...
gets me a "File: "$0\bin\aced.dll" -> no files found." error message. Using a statically defined variable works but is not quite what I want:
!define ACE_ROOT C:\Sources\ACE1.3.3-UCI\ACE_Wrappers
File "${ACE_ROOT}\bin\aced.dll"
Is there anything that will do the trick??
Cheers,
Stevie
Joost Verburg
4th September 2003 13:32 UTC
You are mixing up run-time and compile-time.
ReadEnvStr is a run-time command (will be executed when someone runs your installers). The File parameter is compile-time (it specifies a file on your system to be included in the installer).
${ACE_ROOT} will be replaced by the defined path on compile-time (it's not a variable).
Is it really a problem to store the files you want to include in a known folder? Otherwise you will have to write an application that writes the path to a file and exectute it using !system.
stevie
4th September 2003 15:11 UTC
Hi there Joost,
first of all thanks for you answer.
The problem is that I have to build packages on a per-customer basis. Different clients prefer different library versions, a fact I handle using a script that sets environment variables pointing to the right directories before starting to develop, recompile and package.
Now, to automatize the build process, I'd like to choose the library files to chuck into the package on the environment variables I use anyways. That is, have a batch file set the environment variables, then compile the source and finally start makensis.exe to create the package inserting the right libraries. Is that possible???
Cheers
Stevie
kichik
4th September 2003 15:17 UTC
If the batch file starts makensis use the /D switch to define the desired value. Something like:
makensis "/DACE_ROOT=C:\bla\bla bla" myscript.nsi