Pages

Sunday, September 8, 2013

NSIS SelectSection

So, I haven't seen a working example of how Sections.nsh's SelectSection could be used (at least not one that worked for me anyway).  So here's an example based on what I did in the installer for Meld.  The goal was to include some default sections if the install was silent.
!include "Sections.nsh"
Section "Foo" foo
    ; install stuff here
SectionEnd
Section "un.foo" unfoo
     ; uninstall stuff here
SectionEnd
Function .onInit
     IfSilent isSilent notSilent
     isSilent:
     !insertMacro SelectSection foo
     !insertMacro SelectSection unfoo
     notSilent:
FunctionEnd