Puneet
Puneet

Reputation: 127

NSIS installs sections even after I have removed them

I have built an installer, which consists of 5 sections/components. I have created a pre-function before the components page to check which components are installed, only the components that are not currently installed should be shown on the components page.

!define MUI_PAGE_CUSTOMFUNCTION_PRE selectSections
!insertmacro MUI_PAGE_COMPONENTS

...
Function selectSections
            ; remove sections which are already installed
            ReadRegStr $0 HKLM "${REG_INSTALL}" "SEC_EXTRACTOR"
            IfErrors +2
            !insertmacro RemoveSection ${SEC_EXTRACTOR}
            !insertmacro SelectSection ${SEC_EXTRACTOR}
            ; so on for all components
FunctionEnd

So I install all the components first, and then run the installer again. This time I do not see any components on the components page. But when I press install on that page, all the sections are still executed. Can anyone help ?

(I have pressed the install button from a components page, that does not list any components. but I see those sections being installed in the details pane.)

Upvotes: 0

Views: 40

Answers (1)

Anders
Anders

Reputation: 101666

Don't use relative jumps to skip macros because a macro can be more that one instruction. Use IfErrors label or ${If} ${Errors} from LogicLib.nsh.

Upvotes: 1

Related Questions