Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Compile time: reading value from a .ini file (http://forums.winamp.com/showthread.php?t=173621)

thelliez 16th March 2004 22:40

Compile time: reading value from a .ini file
 
Trying to write a generic installer for different flavors of a product, I would like to have the name of the compiled installer to reflect few options (like a build number).

For example, instead of setup.exe, I would like something like setup_123.exe where 123 is a dynamic string available in a .ini file (built from an ant/cvs script).

If I could do some sort of ReadINIStr at compile time I would be set.

I guess I could try passing parameters to the compiler but it would not be as convenient.

Suggestions?
Thierry

Vytautas 17th March 2004 00:41

You will have to create a 'wrapper' installer using NSIS or any other programming language, then call that wrapper from your nsis script using the '!system' command. This wrapper should read your ini file(s) and either define the required defines automatically or generate an include file which can then be included into the script.

Vytautas

rainwater 17th March 2004 02:29

How about building a config.nsh file that !define's the properties? Otherwise, if you are forced to read a certain ini, then you will need to do what Vytautas said.

tolan 30th November 2006 06:56

You may use some bat magic :)
My solution (tested on WinXP):

!tempfile VAR_FILE
!system '@for /f "eol=# delims== tokens=1,2" %i in (ini_file.ini) do @echo ^!define "%i" "%j" >> "${VAR_FILE}"'
!include "${VAR_FILE}"
!delfile "${VAR_FILE}"
!undef VAR_FILE

Hope this helps.


All times are GMT. The time now is 17:48.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.