Archive: conditional file inclusion


conditional file inclusion
I'm having a bit of difficulty figuring out how to include a file in my installer based on a command line define....

for example, we have 3 versions of the product: DEV, QA, and LIVE

When compiling the installer, I run something like:
for dev:
>makensis.exe /V3 /DVERSION=DEV my_script.nsi
for qa:
>makensis.exe /V3 /DVERSION=QA my_script.nsi
for live:
>makensis.exe /V3 /DVERSION="" my_script.nsi

Now, in my installer, I only want to include a file for the DEV and QA installations....pseudocode:


if(VERSION != empty string)
File "file_to_include.txt"


I'm having difficulty queuing off of whether or not ${VERSION} is an empty string.

!if ${version} == ""
!else if ${version} == "QA"
!endif

Here's what I did:


!if ${VERSION} == ""
!else
File "file_to_include.txt"
!endif


The script compiles fine when VERSION is defined as "DEV" or "QA", but fails when defined as "" :
Usage: !if [!] value [(==,!=,<=,<,>,>=,&&,||) value2] [...]
Error in script "my_script.nsi" on line 75 -- aborting creation process

Right, it must be quoted if it can be empty.

!if "${VERSION}" == ""
!else
File "file_to_include.txt"
!endif

It worked. Thanks man...you're a lifesaver.