Archive: INSTDIR and MUI_PAGE_DIRECTORY behavior problem


INSTDIR and MUI_PAGE_DIRECTORY behavior problem
I am using NSIS 2.43

I have written an install script with the basic components of an installer (PAGE_WELCOME, PAGE_LICENSE, PAGE_COMPONENTS, PAGE_DIRECTORY, PAGE_INSTFILES, and PAGE_FINISH). I am having a problem with the PAGE_DIRECTORY.

I understand that the default behavior of the INSTDIR is to keep the end directory of the path and append that to any newly selected path chosen in the Browse directory dialog. I CANNOT get my script to behave this way.

I set the INSTDIR in the .onInit function to C:\Biodose

It shows up correctly in the Directory dialog, but when I browse and select a directory it does not append Biodose to the newly chosen directory.

From everywhere I have found I read that this should be the behavior as long as there is no trailing backslash (ie C:\Biodose\ should behave as it is now). I have tried it both ways.

I have even created a variable called CompanyName and set the INSTDIR to C:\$CompanyName and its still not working correctly.

The funny thing is that this is the behavior some developers are after, just not me.

Any Ideas???


I believe the above is only the case for the InstallDir directive (set outside functions, sections, etc.)


!addplugindir "."
!addincludedir "."

!include "nsDialogs.nsh"
!include "winmessages.nsh"
!include "logiclib.nsh"

!include "MUI2.nsh"

OutFile "test.exe"

Page Directory dirPre dirShow dirPost

InstallDir "$PROGRAMFILES\myApplication"

Function .onInit
StrCpy $INSTDIR "$PROGRAMFILES\myOtherApplication"
FunctionEnd

Function dirPre
MessageBox MB_OK "Pre: $INSTDIR"
FunctionEnd
Function dirShow
FunctionEnd
Function dirPost
MessageBox MB_OK "Post: $INSTDIR"
FunctionEnd

Section
SectionEnd

!insertmacro MUI_LANGUAGE "English"


You should notice that after the directory is picked, the directory text field ends in 'myApplication', as per the IntallDir directive, rathern than 'myOtherApplcation', as per the .onInit-setting of $INSTDIR.

Thank you Animaether - works now!