Skip to content
⌘ NSIS Forum Archive

multiple directory selection pages

5 posts

muggz77#

multiple directory selection pages

This is my first day working with NSIS, and I am very impressed with what I have seen so far. I am running into one problem though.

I have a script that prompts the user for the install directory as well as an additional directory. The problem arises when I prompt the user for the second directory. For some reason, it always appends the last portion of the default install directory to the selected path.

For example, if default install directory is C:\Program Files\Example1, when the user attempts to select the second directory, something such as C:\Program Files\Example2, the text box that shows what the second directory is will show C:\Program Files\Example2\Example1.

Any help would be appreciated!
Afrow UK#
Sounds like you've got a back-stroke on the end.
InstallDir "C:\Program Files\Example1"
not
InstallDir "C:\Program Files\Example1\"

-Stu
muggz77#
I don't see where a backslash would be causing the problem. Here is a snippet from the script:

InstallDir $PROGRAMFILES\Company\Product
Var DATA_DIR

Page license
Page directory
PageEx directory
DirText "Please select the data directory."
DirVar $DATA_DIR
PageExEnd
Page instfiles

Function .onInit
StrCpy $DATA_DIR "C:\Program Files\data"
FunctionEnd

When the second directory page is displayed, the path is correct, but if the user clicks the browse button, and selects a directory, "\Product" is always appended and returned in $DATA_DIR
pengyou#
The answer is in the User Manual:



If InstallDir ends with a \ then the installer will stop adding \Product to the selected path