Archive: Empty string question


Empty string question
Hello all,

I am new to NSIS (I just started trying it out a few days ago) and I really like using it so far but I have run into an issue that I cannot find a good answer for. Basically I have a Perl script that invokes makensis.exe and it creates and sets symbols using the "/D" switch and I am having a problem detecting when a symbol is null. For example in one of my Sections in my NSI file I have:

!if ${TYPE} == ""
File "..\release\${PRODUCT_EXE_NAME}"
etc...
!endif

; Forensic version files
!if ${TYPE} == "Forensic"
File "..\forensic\${PRODUCT_EXE_NAME}"
etc...
!endif

When I run my Perl script it works fine and chooses the right files to install for "Forensic" and other versions that have actual names but when TYPE is passed in as "" for the default installer I get the following error:

"Usage: !if [!] value [(==,!=,<=,<,>,>=,&&,||) value2] [...]
Error in script "xxx.nsi" on line 169 -- aborting creation process"

Why would I get this error?

The only way around this I have found is to have "null" values be passed in as "''" instead of "" in which case the following works:

!define NSIS_NULL "''"

!if ${TYPE} == ${NSIS_NULL}
File "..\release\${PRODUCT_EXE_NAME}"
etc...
!endif

I also tried using logiclib's ${If} etc and I would get a parameter list error since one of the parameters was null. Am I overlooking something simple here or why can't a parameter be null and why won't my first code example work?

Thanks in advance.


Nevermind, I figured out my error was that ${TYPE} was not enclosed in quotes. Doing so makes things work.