Old 20th April 2007, 18:06   #1
jsnby
Junior Member
 
Join Date: Mar 2007
Location: Glendale, CA
Posts: 5
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:
code:

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



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

Last edited by jsnby; 20th April 2007 at 18:30.
jsnby is offline   Reply With Quote
Old 20th April 2007, 18:18   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
code:
!if ${version} == ""
!else if ${version} == "QA"
!endif


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 20th April 2007, 18:30   #3
jsnby
Junior Member
 
Join Date: Mar 2007
Location: Glendale, CA
Posts: 5
Here's what I did:
code:

!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
jsnby is offline   Reply With Quote
Old 20th April 2007, 18:33   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Right, it must be quoted if it can be empty.
code:
!if "${VERSION}" == ""
!else
File "file_to_include.txt"
!endif


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 20th April 2007, 18:35   #5
jsnby
Junior Member
 
Join Date: Mar 2007
Location: Glendale, CA
Posts: 5
It worked. Thanks man...you're a lifesaver.
jsnby is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump