Skip to content
⌘ NSIS Forum Archive

Install some files only if an other section is activated

4 posts

Sp33dy G0nz4l3s#

Install some files only if an other section is activated

Hello, is it possible that some files in a section will be only installed if e.g. the section1 was activated?

Thank you
Marc
Afrow UK#
There are three options, the first being the base code, and the 2 others being macros which use the same code.

1.
SectionGetFlags ${SEC01} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 Skip

File ...
File ...

Skip:
2. Use SectionFlagIsSet macro from Sections.nsh with ${SF_SELECTED}

3. Use ${If} ${SectionIsSelected} with LogicLib.nsh

-Stu
Sp33dy G0nz4l3s#
Thank you Afrow UK 🙂

I've choosed the option 1 and it works.

Is it perhaps possible that the code checks if e.g. the Section1 and Section2 are activated?
Afrow UK#
Sure, the top bit would be like this:
SectionGetFlags ${SEC01} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 Skip
SectionGetFlags ${SEC02} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
StrCmp $R0 ${SF_SELECTED} 0 Skip
-Stu