Archive: Insisting on a specific subdirectory


Insisting on a specific subdirectory
I want to allow the user to select the directory where to install Vim, but insist that it ends in "vim".

I have a .onVerifyInstDir function for this. This works fine to disable the "install" button until the path typed in the text field ends in "vim".

The undesired side effect is that the dialog of the "browse" button also uses the function, thus disallowing the user to select a directory until he creates a "vim" directory there. Users don't understand this.

I would like to allow the browse dialog to select any directory, and automatically add "vim" to the path when necessary. Is this possible?

A related problem is that this does not always work:
InstallDir "$PROGRAMFILES\Vim"
On Windows 98 I get "c:\Vim" instead of c:\Program Files\Vim".


$PROGRAMFILES should always work, maybe you have changed this folder on your system.

You should check for "vim" in the leave function of the directory page.


You are right, $PROGRAMFILES is not the problem. I'm using a program to find a previously installed Vim, it defaulted to c:\vim. That overruled the default from NSIS.

Using a leave function on the directory page works. I tried adding "vim" automatically there, but the resulting path does not appear in the text entry field. Assigning a value to $INSTDIR in the leave function apparently doesn't work. Is there a trick?


If you want to append it automatically, send a WM_SETTEXT message to the text box after changing $INSTDIR.