Archive: Uninstall won't do it!


Uninstall won't do it!
...well sort of. I've tried looking through the fourm going back quite a while and have tried various things but to no avail, so hopefully someone can help me.

The software I'm working on needs to install into multiple folders (legacy thing as it's old software) and has to be allowed to install on mapped drives (for Citrix types). So I've set the $INSTDIR to C:\ and added files ond folders from there. So far so good, works like a charm.

But, when I come to undo all of this and uninstall, it gets rid of files, but not the folders. Here's the code:

Section "Uninstall"
;## If they are set install context to 'All Users'
SetShellVarContext all
;## remove registry keys
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
SetOutPath $INSTDIR
;## remove files.
SetOutPath "$INSTDIR\CTP"
Delete "$INSTDIR\CTP\*.*"
SetOutPath "$INSTDIR\Program Files\The Exchange\Exweb"
Delete "$INSTDIR\Program Files\The Exchange\Exweb\*.*"
;## remove directories used.
SetOutPath "$INSTDIR\CTP"
RMDir /r "$INSTDIR\CTP"
SetOutPath "$INSTDIR\Program Files\The Exchange\Exweb"
RMDir /r "$INSTDIR\Program Files\The Exchange\Exweb"
;## remove shortcut
Delete "$DESKTOP\Launch Exweb.lnk"
;## remove files.
Delete "$SMPROGRAMS\The Exchange\*.*"
;## remove program group
SetOutPath "$SMPROGRAMS\The Exchange"
RMDir /r "$SMPROGRAMS\The Exchange"
SectionEnd


This has got to be the 30th recompile with minor and major tweaks including a re-wriet of the Uninstall section. But each time, the files go buthe file structure and folders remain.

Yours pleadingly.

Rob


The uninstall won't delete the current directory so try commenting out your SetOutPath lines.


Do a setoutpath to \ (backslash) , this is the root in the top of your script before deleting folders

Then leave out all the setoutpaths.

TIP:
Also close via sendmessage, or forcedkill of running applications still locking a folder and preventing deletion

adding the /REBOOTOK option to RMDis can come in handy.


OK, amended my code so uit now reads:

Section "Uninstall"
SetOutPath "$INSTDIR\"
;## If they are set install context to 'All Users'
SetShellVarContext all
;## remove registry keys
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
;## remove files.
Delete "$INSTDIR\CTP\*.*"
Delete "$INSTDIR\Program Files\The Exchange\Exweb\*.*"
Delete "$SMPROGRAMS\The Exchange\*.*"
;## remove shortcut
Delete "$DESKTOP\Launch Exweb.lnk"
;## remove directories used.
RMDir /r "$INSTDIR\CTP"
RMDir /r "$INSTDIR\Program Files\The Exchange\Exweb"
;## remove program group
RMDir /r "$SMPROGRAMS\The Exchange"
SectionEnd


But it still does not work. It removes the desktop shortcut, but still the folders remain.


I think I may have done something n eh code before which has made it break. Can anyone have a quick look and help out?


You missunderstood onad.
SetOutPath "$INSTDIR\" is the same as
SetOutPath "$INSTDIR"
This is setting the working directory to $INSTDIR which is why you cannot delete it (because it is locked).

As onad has already mentioned, use:
SetOutPath "\"
Or
SetOutPath "$TEMP"

-Stu


Onad and Afrow UK, thanks for the help.

Nearly there now. Still maintains some of the file structure which I can live with for now.

Rob