Namo-sama
3rd May 2005 12:16 UTC
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
RobGrant
3rd May 2005 12:21 UTC
Could you call a function from within the SubSection?
Namo-sama
3rd May 2005 12:33 UTC
Well, I'm quite n00b to NSIS so how would a function like that look?
glory_man
3rd May 2005 13:49 UTC
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
3rd May 2005 14:14 UTC
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
3rd May 2005 14:20 UTC
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
Namo-sama
3rd May 2005 14:31 UTC
Ahh, thanks alot
glory_man
3rd May 2005 14:59 UTC
And don't forget to add OutFile function.
Afrow UK
3rd May 2005 15:46 UTC
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
3rd May 2005 16:24 UTC
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.