Skip to content
⌘ NSIS Forum Archive

Seperate Component Selection Order from Install Order?

4 posts

oceanclub#

Seperate Component Selection Order from Install Order?

As far as I'm aware, the order of Sections determines both:

* The order in which those components are presented to the user for selection on the Choose/Select Components page.

* The order in which any installation commands such as "File" are run.

Can I have two components, A & B, presented for selection as:

* A
* B

But if the user selects to install both, the files associated with B are installed _before_ A?

I know this is a minor matter but hope someone could offer a simple solution.

Thanks,

P.
kichik#
Add another invisible section after those two. In that section, check if section B is selected and if so, do something. Then check if section A is selected and if so, do another thing. In section A and B, do nothing. This way, you can control the order of execution while retaining the visible order.
oceanclub#
Originally posted by kichik
Add another invisible section after those two. In that section, check if section B is selected and if so, do something.
Thanks. Would I use !define and !ifdef for this?

For example:

Section "Component A"

; stuff

!define UseChoseComponentA "true"

SectionEnd

Section "Component B"

; stuff

!define UserChoseComponentB "true"

SectionEnd

Section

; invisible section

!ifdef UserChoseComponentB
file /r DirectoryB
!endif

!ifdef UserChoseComponentA
file /r DirectoryA
!endif
kichik#
No, those are for compile time. Simply set some variable in section A and B to let section C know it should do something.
!include LogicLib.nsh
Var A
Var B
Section A
StrCpy $A install
SectionEnd
Section B
StrCpy $B install
Section End
Section ""
${If} $A == install
# install A
${EndIf}
${If} $B == install
# install B
${EndIf}
SectionEnd