我有一个部门组,在这个组中我有4个部分。 我想要的是:只为该组只读取前两个部分,并在卸载部分中保留其余部分。
我的代码如下:
Function un.onInit
!insertmacro SetSectionFlag ${firstUnSec} ${SF_RO}
!insertmacro SetSectionFlag ${secondUnSec} ${SF_RO}
FunctionEnd
SectionGroup "What to delete" groupsec
Section "un.First part" firstUnSec
Call "un.DropFirst"
SectionEnd
Section "un.Second part" secondUnSec
Call "un.DropSecond"
SectionEnd
Section "un.Third part" thirdUnSec
Call "un.DropThird"
SectionEnd
Section "un.Forth part" forthUnSec
Call "un.DropForth"
SectionEnd
SectionGroupEnd
但它只使该组只读,并且组内的每个部分都是可选的!那是为什么?
谢谢!
答案 0 :(得分:1)
使用节索引的代码必须位于.NSI文件中的节本身之后。
SectionGroup "What to delete" groupsec
Section "un.First part" firstUnSec
Call "un.DropFirst"
SectionEnd
SectionGroupEnd
Function un.onInit
!insertmacro SetSectionFlag ${firstUnSec} ${SF_RO}
FunctionEnd
如果代码始终只读,则您不需要任何代码,您可以在编译时设置section属性:
SectionGroup "What to delete" groupsec
Section "un.First part" firstUnSec
SectionIn RO
Call "un.DropFirst"
SectionEnd
SectionGroupEnd