ilaiyaraja
19th September 2012 12:34 UTC
How can i parse property file in NSIS ?
I have a .property file in my Java project. In that property file have more than 20 values. Now I want to parse that property file and change the specific property value at run time(that is when run the install file).
My requirements:
1.I need to give value for SERVER.URL property at run time (while installing the exe file)?
2.How parse property file in java?
MSG
19th September 2012 14:13 UTC
Assuming it's a plaintext file, you can use the textfunc.nsh macros detailed in Appendix E of the manual. For example ConfigRead: http://nsis.sourceforge.net/Docs/AppendixE.html#E.2.9
ilaiyaraja
19th September 2012 14:31 UTC
@MSG Thanks.ya.you are correct.In that case i have more than one value need to read and parse it.How its possible? and also If i use ${configread} values can be hard coded.I dont like this.I need to give input value at run time while installing the exe file only.correctly i have tried this,
${ConfigWrite} "C:\resource\conf.properties" "WEBSERVICE.URL" "=http://localhost:8080" $0
I need to give this http://localhost:8080 value at run time?
MSG
19th September 2012 20:44 UTC
Parameters to ConfigWrite do not need to be hardcoded, you can use a variable as the parameter.
If there are multiple occurrences of a certain configuration entry, you'll probably have to parse the file manually with LineFind etc.
ilaiyaraja
20th September 2012 08:32 UTC
@ MSG thanks.Is it possible to pass values in dynamically?(ie without hard code values).can you explain me more or share any link?
yes.i want to pass more than one value.so i think need to use LineFind.If you know any example or tutorial please share to me.Its really help for me
Thanks
MSG
20th September 2012 11:39 UTC
LineFind examples in the manual. Pass dynamic values simply by putting a $variable as parameter, and giving the variable a value at runtime.