灵活应用逻辑库

优质
小牛编辑
115浏览
2023-12-01
组件1包括:1.txt,2.txt 组件2包括:3.txt 4.txt

当组件1和组件2都选中时安装所有文件,当组件2选中而组件1未选中时安装文件3.txt,不安装组件2所属的文件4.txt。当组件1选中而组件2未选中时仅安装组件1所属的文件。

用逻辑库实现:

LOGICLIB_SECTIONCMP
!include LogicLib.nsh

Section "区段1" Sec1
File 1.txt
File 2.txt
SectionEnd

Section "区段2" Sec2
File 3.txt
${If} ${SectionIsSelected} ${Sec1}
File 4.txt
${EndIf}
SectionEnd

当然,不用逻辑库也可以,就是麻烦一些:

Section "区段1" Sec1
File 1.txt
File 2.txt
SectionEnd

Section "区段2" Sec2
File 3.txt
SectionGetFlags ${Sec1} $0
IntOp $0 $0 & 1
IntCmp $0 0 no4
File 4.txt
no4:
SectionEnd