Archive: I'm trying to have an answer about two directories in one installer until two days !!


I'm trying to have an answer about two directories in one installer until two days !!
Hi,
I'm waiting for your help about my question i posted until yesterday; it seems nobody wants to reply to me.
Thanks to have a look :

I'm trying to have in my installer two directories; one for my application and another for my database.
I have already posted but nobody answered me yet.
I have read in the archive this : http://nsis.sourceforge.net/archive....php?pageid=553

That is not exactly what i want and i have adapted it:

Here is my code that you can test; for the instructions in the sections, i just display messages:

#begin of my code
!include "Sections.nsh"

Name Test
OutFile test.exe

Page components

Var ECITIZ_DIR
PageEx directory
DirText "Ceci installera l'Application"
DirVar $ECITIZ_DIR
PageCallbacks DirectoryAppliPre "" ""
PageExEnd

Var POSTGRES_DIR
PageEx directory
DirText "Ceci installera la Base de Données PostgreSQL \ dans le dossier suivant; pour l'installer dans un autre \ dossier,cliquez parcourir et choisissez un autre dossier. \ Cliquez suivant pour continuer." "Installation de \
la Base de Données PostgreSQL"
DirVar $POSTGRES_DIR
PageCallbacks DirectoryBDPre "" ""
PageExEnd

Page instfiles

!macro SiCocheAlorsVaA TMPVAR SECTION GOTO
SectionGetFlags ${SECTION} ${TMPVAR}
IntOp ${TMPVAR} ${TMPVAR} & ${SF_SELECTED}
IntCmp ${TMPVAR} 1 ${GOTO} +1
!macroend

Function DirectoryAppliPre
Push $1
StrCpy $ECITIZ_DIR "c:\ecitiz"
!insertmacro SiCocheAlorsVaA $1 eCitiz afficherPageAppli
!insertmacro SiCocheAlorsVaA $1 examples afficherPageAppli
Pop $1
Abort

afficherPageAppli:

FunctionEnd

Function DirectoryBDPre
Push $1
StrCpy $ECITIZ_DIR "c:\postgres"
!insertmacro SiCocheAlorsVaA $1 bdd afficherPageDB

Abort

afficherPageDB:
Pop $1
FunctionEnd

SubSection "e-Citiz"
;sous-section d'installation du studio
Section "!e-Citiz Studio" eCitiz
SetOutPath $INSTDIR
MessageBox MB_OK "eCitiz"
SectionEnd

;Sous-section d'installation du bouquet
Section /o "!Exemples de Téléprocédures" examples
SetOutPath $INSTDIR
MessageBox MB_OK "examples"
SectionEnd

Section "!Raccourcis" short
MessageBox MB_OK "short"
SectionEnd

SubSectionEnd


SubSection "Base de données"
# Sous-section d'installation de posgreSQL
Section "!PostgreSQL" bdd
MessageBox MB_OK "bdd"
SectionEnd
SubSectionEnd

SubSection "Adobe Acrobat Reader"
# Sous-section d'installation de Acrobat Reader
Section /o "!Adobe Acrobat Reader" adobe
MessageBox MB_OK "adobe"
SectionEnd
SubSectionEnd

#end of my code

a°)What i would like to do:
1°)if and only if i select sections with index "eCitiz" or "examples", it displays the page to select the directory for the Application; in all other cases it must not display this page to select the directory for my Application.
2°)if and only if i select sections with index "bdd", it displays the page to select the directory for my Data Base; in all other cases it must not display this page to select the directory for my Data Base.

b°)How it works now :
1°)if i select sections with index "eCitiz" or "examples",and i click on next it starts executing instructions in sections "eCitiz" or "examples", without displaying the page to select the directory for the Application.
2°)if i select sections with index "bdd",and i clisk on next it starts executing instructions in sections "bdd" , without displaying the page to select the directory for the DataBase.

3°)if i select the three sections with index "eCitiz", "examples",and "short",and i click on next it displays first the page to select the directory for the Application, and after the page to select the directory for the DataBase even if i have not select the section "bdd"

4°)if i select the four sections with index "eCitiz", "examples","short",and "bdd",and i click on next, it displays first the page to select the directory for the Application, and after the page to select the directory for the Data Base ;before executing instructions in the sections (here all is rigth).

I think it is about the two functions "DirectoryAppliPre" and "DirectoryDBPre" or the macro "SiCocheAlorsVaA" ?
Is there a bug in NSIS ?
All seem to be logic in my code !!!
Can somebody tell me what is wrong ?

Thanks to have a look to my question !!

:) :)


#begin of my code

!include "Sections.nsh"

Name Test
OutFile test.exe

Page components

Var ECITIZ_DIR

PageEx directory
DirText "Ceci installera l'Application"
DirVar $ECITIZ_DIR
PageCallbacks DirectoryAppliPre "" ""
PageExEnd

Var
POSTGRES_DIR

PageEx directory
DirText "Ceci installera la Base de Données PostgreSQL \ dans le dossier suivant; pour l'installer dans un autre \ dossier,cliquez parcourir et choisissez un autre dossier. \ Cliquez suivant pour continuer." "Installation de \
la Base de Données PostgreSQL"
DirVar $POSTGRES_DIR
PageCallbacks DirectoryBDPre "" ""
PageExEnd

Page
instfiles

############ first: Section ################# notice

SubSection "e-Citiz"
;sous-section d'installation du studio
Section "!e-Citiz Studio" eCitiz
SetOutPath $INSTDIR
MessageBox MB_OK "eCitiz"
SectionEnd

;Sous-section d'installation du bouquet
Section /o "!Exemples de Téléprocédures" examples
SetOutPath $INSTDIR
MessageBox MB_OK "examples"
SectionEnd

Section
"!Raccourcis" short
MessageBox MB_OK "short"
SectionEnd

SubSectionEnd


SubSection
"Base de données"
# Sous-section d'installation de posgreSQL
Section "!PostgreSQL" bdd
MessageBox MB_OK "bdd"
SectionEnd
SubSectionEnd

SubSection
"Adobe Acrobat Reader"
# Sous-section d'installation de Acrobat Reader
Section /o "!Adobe Acrobat Reader" adobe
MessageBox MB_OK "adobe"
SectionEnd
SubSectionEnd

############## secondly: function ############## notice

!macro SiCocheAlorsVaA TMPVAR SECTION GOTO
SectionGetFlags ${${SECTION}} ${TMPVAR} # <<<<<< advert: "${${SECTION}}"
IntOp ${TMPVAR} ${TMPVAR} & ${SF_SELECTED}
IntCmp ${TMPVAR} 1 ${GOTO} +1
!macroend

Function DirectoryAppliPre
Push $1
StrCpy $ECITIZ_DIR "c:\ecitiz"
!insertmacro SiCocheAlorsVaA $1 eCitiz afficherPageAppli
!insertmacro SiCocheAlorsVaA $1 examples afficherPageAppli
Pop $1
Abort

afficherPageAppli:

FunctionEnd

Function
DirectoryBDPre
Push $1
StrCpy $ECITIZ_DIR "c:\postgres"
!insertmacro SiCocheAlorsVaA $1 bdd afficherPageDB

Abort

afficherPageDB:
Pop $1
FunctionEnd

#end of my code