otahalm
23rd July 2012 12:19 UTC
How to get one of many possible files to one target during instalation process?
How to get one of many possible files to one target during installation process?
I am using NSIS for our installation programs. Now I need to store 10 clones of one file to prepared exe files and during the installing process dynamically choose one of them to copy to target PC. Does someone know how to store these 10 files into exe files elegantly?
Thank you very much for your opinions.
MSG
23rd July 2012 15:02 UTC
SetOutPath $INSTDIR
${If} (some runtime condition here)
File /oname=file.dat file_condition1.dat
${EndIf}
See the manual:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.5
otahalm
25th July 2012 08:59 UTC
Thank you, but I need something different:(. I need to compress many files bud decompressed only one file according a runtime condition. I am going to do it by repeating very similar parts of codes:(. It seems to me to be too difficult. Is there any possibility to use some loop structures or something more elegant;)? Thank you for your opinion:).
otahalm
25th July 2012 09:46 UTC
I have already solved it using this "case" statement:
SetOutPath "$INSTDIR\$Condition"
${If} $Condition == "11"
File "${SourceDir}\11\a.txt"
${ElseIf} $Condition == "99"
File "${SourceDir}\99\a.txt"
${EndIf}
This is easy enough. Thank you.