Archive: Checking previous version before install...


Checking previous version before install...
Hello,

1)I would like to know if it's possible to check if a previous version is installed and unistall it before process for the new one ?

2)I would like to know if I could put the unist.exe to a specific folder ?

Some one could give me those code it would help me thx.


There are tonnes of ways to check if an old version exists. If you know the path to say the executable, then you could use GetDLLVersion.
You can then use this function to compare version numbers:
http://nsis.sourceforge.net/archive/...ances=0,11,122

You shouldn't put the uninstaller to another folder other than $INSTDIR unless you plan on writing the $INSTDIR to the registry in your installer and then reading it again within your uninstaller. As default your uninstaller will use its $EXEDIR as it's $INSTDIR (ie it will uninstall what's in the folder that it was placed in).

WriteUninstaller "$INSTDIR\uninstall.exe"

-Stu


ok thx would test it but I have a problem if the user place the installation in a diff folder that the one predefined could I check the install path of the user by checking the registry and how could do it ? and how could write the line to check in the registry ?

Thx in advance.


To write values in the register use WriteRegStr or WriteRedDWORD.
To read istallation dir use

InstallDirRegKey
root_key subkey key_name

Look the documentation about these functions.

ok great thx i'll check it.