Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a variable at run time

Tags:

nsis

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?

like image 497
Harry Avatar asked Aug 15 '12 12:08

Harry


1 Answers

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.

like image 149
Slappy Avatar answered Oct 12 '22 12:10

Slappy