Skip to content
⌘ NSIS Forum Archive

Files in SubSection

10 posts

Namo-sama#

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
glory_man#
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.
Namo-sama#
Well, that sounds like it would work but how do I do this check ie. how would the code for it look like?
glory_man#
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
Afrow UK#
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
glory_man#
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.