开发者

Conditional Display of pages in NSIS using nsDialog

I have added a custom page to my installer created using nsDialogs, however, the page is only necessary to be displayed to one of my InstType options.

InstType "Default" # 1
InstType "Developer" # 2

In the example above, I'd like the extra page to be shown to only developers. What is the best practice?

  1. Inspect some attribute to determine the 开发者_JAVA百科install type and suppress call to nsDialogs::Show? No idea what attribute to look for
  2. Some logic in the page routing that avoids the page being hit? No idea how to do this
  3. Something else?


To skip a page, call abort in the create function callback for that page.

!include LogicLib.nsh

InstType "Normal"
InstType "Developer"

Page Components
Page Custom myDevPage
;Page start menu etc...
Page InstFiles

Section /o "" ${SEC_Dev}
;This (hidden) section is used just to check the insttype state, but you could also use it to install dev specific files etc
SectionIn 2
Sectionend

Function myDevPage
${IfNot} ${SectionIsSelected} ${SEC_Dev}
    Abort
${EndIf}
;nsDialog code goes here
FunctionEnd
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜