Archive: .onVerifyInstDir & Browse Button


.onVerifyInstDir & Browse Button
In one of the other threads there was a discussion on how to prevent the installer automatically adding the value of ${MUI_PRODUCT} to the end of the $INSTDIR after the user clicks the browse button, e.g. make sure that the path ends with '\'.

I tried to achieve this by using .onVerifyInstDir function however the path was modified before the function was called :(

Is there a function which is called after the user clicks OK on the Select Folder dialog but before NSIS adds ${MUI_PRODUCT} to the end of the path?

Vytautas


Hi,

I found the same problem, my solution was to not especify default path with "InstallDir", example:
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}" ; -> you must comment this out

than put on your .onInit:

Function .onInit
...
StrCpy $INSTDIR $PROGRAMFILES\${MUI_PRODUCT}
...
FunctionEnd


Thanx ramon18, your idea worked well. Just one note the StrCpy command produced an error when building.

than put on your .onInit:

Function .onInit
...
StrCpy $INSTDIR $PROGRAMFILES\${MUI_PRODUCT}
...
FunctionEnd
The following fixed that problem:
...
StrCpy $INSTDIR "$PROGRAMFILES\${MUI_PRODUCT}"
...

Just in case someone has the same error when making the installer.