Old 16th March 2004, 22:40   #1
thelliez
Junior Member
 
Join Date: Feb 2004
Posts: 23
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
thelliez is offline   Reply With Quote
Old 17th March 2004, 00:41   #2
Vytautas
Major Dude
 
Vytautas's Avatar
 
Join Date: May 2003
Location: Victoria, Australia
Posts: 643
Send a message via ICQ to Vytautas
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
Vytautas is offline   Reply With Quote
Old 17th March 2004, 02:29   #3
rainwater
Senior Member
 
Join Date: Aug 2000
Posts: 397
Send a message via ICQ to rainwater
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.
rainwater is offline   Reply With Quote
Old 30th November 2006, 06:56   #4
tolan
Junior Member
 
Join Date: Nov 2006
Posts: 13
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.
tolan 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