Archive: Behavior of installation directory selection dialog


Behavior of installation directory selection dialog
It seems that MUI_PAGE_DIRECTORY always appends "SOMELASTDIR" to the selected path if the default INSTDIR was set to something like "SOMEPATH\SOMELASTDIR". Is there an option to suppress this? I suppose it is a safety precaution for those uninstallers which dare to call
"RMDir /r $INSTDIR",
but I'd really like to pick any directory name.

Of course, I could always process the string later, but then I have to be very careful that the selected INSTDIR is different from the default INSTDIR, otherwise nothing may be removed (and with things like UNC and short file names you never feel quite confident that the same string will be returned for the same path).

Also, when the dialog appends SOMELASTDIR to the selection, it would be more logical if the initial directory selection when opening the dialog would be SOMEPATH, not SOMEPATH\SOMELASTDIR.

Furthermore, when a path is selected which is different from the default INSTDIR, and the user clicks "Browse" again, the initial directory seems to be wrong (I get My Documents).

Finally, if the user is logged in with a normal account but starts the installer with "Run As ..." to get administrator privileges, the dialog does not get updated when a new folder is created or renamed in the dialog. But this is probably an issue of the system dialog (tested on W2K SP4 and XP SP3).


Append a backslash to InstallDir.

InstallDir "$PROGRAMFILES\NSIS\"

Thank you, this works. I was looking into the documentation
for MUI, it didn't occur to me to search for this special
behavior under InstallDir, especially as I do my own
initialization of $INSTDIR in onInit.

It's a bit confusing, am I correct in assuming that
$INSTDIR will never end with "\" even if InstallDir
ends with "\"? Is InstallDir handled differently
from StrCpy $INSTDIR "..."?


$INSTDIR can never end with a backslash, no matter how you set it. This is to make sure it always points to a valid path.