NSIS Start Menu problem
Hi,
I'm writing an installer for an application that customers may want to install multiple times.
I'm trying to check the install directory and start menu folder to ensure that the customer does not overwrite an existing installation (they can't anyway as the installer has overwrite is set to off - but I want a visible warning and the ability to change the install dir)
I use the pre and leave functions with MUI to check the selected install dir and start menu folder. The former works fine - $INSTDIR gets the value of the selected install dir and the LEAVE function uses that in its test. However, but the start menu checks don't work as the path entered in the start menu dialog doesn't get written into the start menu variable (MUI_PAGE_STARTMENU page_id variable)
The attached file is a stripped down version of the installer - it's just intended to show the problem.
To test it:
1. Create a folder call Batch in the same folder as the script. Put a few files in it.
2. Compile the script
3. Run the resulting setup - the app gets installed in the default install dir and start menu folder.
4. Run the setup again.
5. If you specify the default install dir you'll get a warning.
6. Change the install dir - that works ok.
7. Specify the default start menu folder - again you get a warning.
8. Change the start menu folder. The changed value does not get picked up.
9. Click on the back button and then on the Next button. This time the value of the start menu folder is correctly picked up by the installer.
Am I doing something wrong?
If not, is there a workaround?
I tried an invisble custom installer page directly after the start menu page. This picked up the user-specified value of the start menu folder but I couldn't work out how to send the installer back to the start menu page (so user could reenter start menu folder value)
I also tried the getDlgValue to get the control id the page element that contains the start menu folder string - but there doesn't seem to be a method for reading the actual value when you know the control id.
Finally, had a look inside system.nsh in NSIS\Contrib\Modern UI. Can't see where the dialog value for the start menu folder is picked up.
Thanks,
Eoin