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
.onVerifyInstDir & Browse Button
3 posts
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
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.
...
StrCpy $INSTDIR "$PROGRAMFILES\${MUI_PRODUCT}"
...
Just in case someone has the same error when making the installer.
than put on your .onInit:The following fixed that problem:
Function .onInit
...
StrCpy $INSTDIR $PROGRAMFILES\${MUI_PRODUCT}
...
FunctionEnd
...
StrCpy $INSTDIR "$PROGRAMFILES\${MUI_PRODUCT}"
...
Just in case someone has the same error when making the installer.