如何仅为NSIS中的某个部分组仅部分制作部分部分?

问题描述 投票:0回答:1

我有一个部门组,在这个组中我有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

但它只使组成只读,组内的每个部分都是可选的!这是为什么?

谢谢!

nsis
1个回答
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
© www.soinside.com 2019 - 2024. All rights reserved.