- NSIS Discussion
- InstallDirRegKey, not sure what happens?
Archive: InstallDirRegKey, not sure what happens?
Breepee
3rd March 2004 08:53 UTC
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.
Joost Verburg
3rd March 2004 09:02 UTC
If the key does not exist it uses the default folder set using InstallDir.
Breepee
3rd March 2004 09:05 UTC
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.
Joost Verburg
3rd March 2004 09:06 UTC
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.
Breepee
3rd March 2004 09:28 UTC
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?
Joost Verburg
3rd March 2004 09:41 UTC
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.
Breepee
3rd March 2004 09:43 UTC
How can I check what the default folder in Windows is?
Joost Verburg
3rd March 2004 10:06 UTC
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.
Breepee
3rd March 2004 10:16 UTC
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).
Joost Verburg
3rd March 2004 10:22 UTC
$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.
Breepee
3rd March 2004 10:40 UTC
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.