Archive: Variable output file


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?


NSIS installation script uses defines !

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

:D


Re: Variable output file

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.

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


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.


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