I am making an NSIS script which checks if a previous version of the application is installed. If so, it asks whether or not the configuration file should be imported from this previous version. So I have a global variable config file which I am trying to set at runtime depending on whether the user chooses "yes" or "no". The problem I am having is when compiling it complains with File: "${XMLConfigDir}*.xml" -> no files found. because XMLConfigDir has not been set yet. So is there anyway to set a variable at runtime?
There is difference between declaring variables (Var command) and symbols (defined with !define command):
Var /GLOBAL myVar ; This is variable -> use it as $myVar
!define mySymbol; This is symbol -> use it as ${mySymbol}
Try this:
!define XMLConfigDir "C:\some_path_to_XML\subdir\"
Section "Main Section"
File "${XMLConfigDir}*.xml"
SectionEnd
Symbols can be also set using /D command line switch during installer runtime.
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