Old 9th July 2002, 18:01   #1
toopriddy
Junior Member
 
Join Date: Jul 2002
Posts: 2
Variable output file

I am working on a cross platform project and would like NSIS to generate an output file like d-builder-0.0.4.exe where the 0.0.4 is the current version number. This version number is in a file all by itself for me to compile into my code

I have tried to come up with a script to make NSIS read this file to get the version number and create an output file with that version number in it

like:

FileOpen $8 ../version r
FileRead $8 $9
FileClose $8

OutFile "d-builder-$8.exe"


but File* commands have to be in a section and the OutFile is not valid in a section...

Any suggestions?
toopriddy is offline   Reply With Quote
Old 9th July 2002, 18:09   #2
veekee
Senior Member
 
Join Date: Mar 2002
Location: France / Paris
Posts: 138
NSIS installation script uses defines !

!define VER_MAJOR 1
!define VER_MINOR 98
nsis${VER_MAJOR}${VER_MINOR}_fr.exe

veekee is offline   Reply With Quote
Old 9th July 2002, 21:01   #3
rainwater
Senior Member
 
Join Date: Aug 2000
Posts: 397
Send a message via ICQ to rainwater
Re: Variable output file

Quote:
Originally posted by toopriddy

FileOpen $8 ../version r
FileRead $8 $9
FileClose $8

OutFile "d-builder-$8.exe"
The FileRead does not occur when you compile the script, but when you run the installer. The easiest way, is to write a stub installer that reads the file, and then calls makensis with the define values on the command line. Then the script can read the define values to get the OutFile name.
rainwater is offline   Reply With Quote
Old 10th July 2002, 17:41   #4
toopriddy
Junior Member
 
Join Date: Jul 2002
Posts: 2
part deaux

ok, i can live with that, but when i run the comand line version with the define in the command line... it still does not use the define (it will use the define if i explicitly put the define in the script, but that is not what i want)

command line:
"C:\Program Files\NSIS\makensis.exe" /V4 /CD d-builder.nsi /DDBUILDERVERSION=0.0.4


script:

Name "Distributed Builder"
OutFile "d-builder-${DBUILDERVERSION}.exe"


it notices my command line define, but does not substitute the variable for the value

I tried just putting a !define DBUILDERVERSION "0.0.4" above the OutFile and it works fine, so the problem it just the command line define
toopriddy is offline   Reply With Quote
Old 10th July 2002, 20:23   #5
Smile2Me
Guest
 
Posts: n/a
Uservariables and defines only get their value at runtime. When you compile, the variables will not have a value yet and that's why you can't use them in compiling commands like OutFile and File.

-Hendri.
  Reply With Quote
Old 10th July 2002, 21:11   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Your command line define doesn't work because you specify it after the name of the script to compile. Don't ask me why, but this is how it is...

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
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