Skip to content
⌘ NSIS Forum Archive

The installer installs nothing after a uninstall

6 posts

Romuuu#

The installer installs nothing after a uninstall

Hello everyone,

I created an installer which check if a version of my program is already installed before the installation.
If true, the installer launch the uninstaller (if the user agrees), and after the uninstall, the installation is launch.

When nothing is installed, the installer copies all the files in the right place. But if a version is already installed, and if the user clicks ok, the unsinstall is ok, but when the installer finish his job, nothing is copied (the unsinstall.exe is the only thing which is copied).

Someone knows this problem?

Thanks in advance for your answers.

Regards,
Romuuu
Animaether#
would need more information / script code. Typically the pseudocode would be...

if previous installation detected (
  run that installation's uninstaller
)
install 
There's very little that can go wrong with that in principle.
Afrow UK#
Are you running the uninstall using ExecWait with _?=[old_install_dir]? If you omit the _?= switch the uninstaller will spawn a new process and ExecWait will not wait. That sounds like it could be your problem.

Stu
Romuuu#
Hi, and thanks for the answers.

I forgot to specify that I am using NSIS with CMake (CPack).
Here is the code :

ReadRegStr $0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion"
  StrCmp $0 "" no_other_version 0
  StrCmp $0 ${PRODUCT_VERSION} 0 other_version
    MessageBox MB_YESNO "$delete_already_installed" IDYES 0 IDNO keep_previous_installation
      ReadRegStr $1 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
      ExecWait '"$1" _?=$INSTDIR' $0
      IntCmp $0 0 no_other_version keep_previous_installation
    keep_previous_installation:
      MessageBox MB_OK "$cannot_be_installed" IDOK 0
      Quit
  other_version:
    MessageBox MB_YESNO "$delete_deprecated" IDYES 0 IDNO no_other_version
      ReadRegStr $1 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
      ExecWait '"$1" _?=$INSTDIR'
  no_other_version: 
The installer waits the uninstaller to do his job.

Thanks in advance.


Regards,
Romu
Romuuu#
I found the problem.
The registry was checked before running the uninstaller.
Now it is checked after.

Thanks for your answers, this ppost can be closed.

Regards,
Romu