views:

23

answers:

1

I am using NSIS to create my installers/uninstallers, and the uninstaller seems to have a weird behavior.

I don't put the installer in $INSTDIR, it is located at $INSTDIR/subdir/uninstall.exe (it's a addon installer for a host application).

When I run the installer then, it thinks the application installation root is $INSTDIR/subdir instead of $INSTDIR. It then can't find all the files in subdir/* as it's already in subdir.

If I move the executable, it seems to just accept the current directory as where the application installation root is. I can move it to $INSTDIR and all is well.

Thanks.

+1  A: 

$INSTDIR in the uninstaller is just the directory the uninstaller is in (Not the same as current directory necessarily)

If you can just put the uninstaller in the root of the install, that is the best option, otherwise you have to do something ugly like strcpy $instdir "$instdir\.." or use a define in every Delete/RMDir call.

Alternatively, if you save the install dir somewhere in the registry during install, you could read it back in the uninstaller.

Anders