NSIS Section flag tests

Today I learned:

[sourcecode language=”Python”]
SectionGetFlags ${SEC_AI}      $0
${If} $0 == ${SF_SELECTED}
[/sourcecode]

I was using the above code and getting inconsistent behavior. Turns out ${SF_SELECTED} is defined in sections.nsh bitmask style. The statement above ONLY works for a section that is selected and has no other attributes set. A read-only section that is selected, for example, will be set to “17” — 1 (selected) + 16 (readonly). Turns out that LogicLib has a way to make life easier:

[sourcecode language=”python”]
${If} ${SectionIsSelected} ${SEC_AI}
[/sourcecode]

Leave a Reply

Your email address will not be published. Required fields are marked *