Skip to content
⌘ NSIS Forum Archive

StrCmp: relative jumps VS labels

4 posts

cosmic66#

StrCmp: relative jumps VS labels

I would like to disable uninstaller sections depending on if
the corresponding section had been selected on install.

Why does the following work:


Function un.onInit
Push $0
ReadINIStr $0 "$INSTDIR\${CONFIG_FILE}" "SectionName" "Sec01"
StrCmp $0 "" no yes
no:
!insertmacro UnselectSection ${unSec01}
yes:
FunctionEnd


Whereas the following disselects the section in any case:

Function un.onInit
Push $0
ReadINIStr $0 "$INSTDIR\${CONFIG_FILE}" "SectionName" "Sec01"
StrCmp $0 "" +1 +2
!insertmacro UnselectSection ${unSec01}
FunctionEnd
Joost Verburg#
Remember that a relative jump jumps over a certain number of commands.

You are inserting a macro that includes multiple commands. Using a label is recommended.