Archive: Dynamic filename


Dynamic filename
Hi,

I save the build number of my program in an ini file (which is all automatically and such).
from now on I have always renamed the installer files to version1.0.0.exe and version1.0.1.exe and such.

Is there any way to dynamically create the filename of the installer according to that INI file?


You can call makensis.exe with a /D parameter to define a version. For example, have this in your script:

OutFile version${VERSION}.exe
and then call makensis.exe from your automatic build system like this:
makensis.exe /DVERSION=1.0.0 script.nsi
If it must be according to that INI file, you can create another program which will read this INI (can be a NSIS installer itself) and call makensis.exe as exaplined above.

Same "problem" here. My solution is a little helper exe.


; take version number from ini file
!system 'if exist _defines.nsh del _defines.nsh'
!system 'helpers\buildDefinesNsh.exe'
!include '_defines.nsh'


buildDefinesNsh reads my ini and writes _defines.nsh


;this file will be overwritten (automatically generated)
!define PROGRAM_VERSION "2.0.0.1"