Archive: InstallDirRegKey, not sure what happens?


InstallDirRegKey, not sure what happens?
If i specify a key/value in the registry to copy files to using InstallDirRegKey, what will happen if that key/value doesn't exist, and there no InstallDir specified?

I've set the install to be silent, and the compiled exe exits, but I'm not sure if it does anything. When I remove SilentInstall silent, it comes up with an empty installdir and the Install button is disabled.


If the key does not exist it uses the default folder set using InstallDir.


I know, but I havn't set a folder. And since the installer is silent and it quits, I wonder what it does. Copy files somewhere (where?) or just nothing.


There is no directory page in a silent installer, so it will install in the current folder.

Check the value of $INSTDIR if you want to prevent that.


I doesn't install in the current folder, because I don't see the files there. In fact, I think it just does nothing, but I want to know if that (in theory) is true, or should indeed extract to the current dir (which isn't the case).

Not that I mind it does nothing. I'm trying to use this 'trick' to update a program, if it's installed. What if I put this installer/updater onto a CD? It can't write to the current dir there. Will it give (visible) errors?


If the installation directory is empty it should install in the default folder.

That does not have to be folder in which the installer is located. It's the folder that is currently the default folder in Windows. It may be the desktop, your root drive or something else.


How can I check what the default folder in Windows is?


Depends on what is currently set by the applications you are running.

SetOutPath sets the current directory, but if you have not set it or set it to an empty installation folder, you can't be sure about it.


In my script, SetOutPath is "$INSTDIR". What does this mean? I've searched my hard disks for the files, but I found them nowhere (apart from the source files).


$INSTDIR is the folder that is selected in the installer using InstallDir, InstallDirReg and the directory page.

In your case this value is empty. To prevent it from installing anything use StrCmp to compare the value of $INSTDIR and quit if it's empty.


Ah, like this:

Section "MainSection" SEC01
StrCmp $INSTDIR "" equal unequal
equal:
Quit
unequal:
SetOutPath "$INSTDIR"
SetOverwrite on
etc....
SectionEnd

Seems to work, although I cant find any difference between behaviour, but I suppose this way is more secure.