Archive: Files in SubSection


Files in SubSection
Can you out files in a SebSection

Example:
[A]
|->[B]
|->[C]

B and C have some files in common that I want to be installed when B or C is selected.

If I put a file statment under SubSection A it produce the error:


Error: command File not valid outside section or function

Could you call a function from within the SubSection?


Well, I'm quite n00b to NSIS so how would a function like that look?


I think function cann't help you.
I can propose following solution. You can create hidden section outside sectiongroup. Inside this section check selected condition of B and C sections (SectionGetFlags), and if one of them selected install your files.


Well, that sounds like it would work but how do I do this check ie. how would the code for it look like?


Something like this:


SectionGroup A

Section B SecB
.... code ....
SectionEnd

Section C SecC
.... code ....
SectionEnd

SectionGroupEnd

Section "-common"
SectionGetFlags ${SecB} $R0
SectionGetFlags ${SecC} $R1
IntOp $R0 $R0 | $R1
IntOp $R0 $R0 & 0x1
StrCmp $R0 "1" install noinstall
install:
File ...
File ...
noinstall:
SectionEnd

Ahh, thanks alot


And don't forget to add OutFile function.


It would be simpler to have a hidden Section in your SectionGroup:

SectionGroup A

Section
...
SectionEnd

Section B SecB
.... code ....
SectionEnd

Section C SecC
.... code ....
SectionEnd

SectionGroupEnd

-Stu


I was tried this first.
In this case user can disable hidden section when deselect all sectiongroup. And after that if user choose one of section common files will not be installed.