Archive: Cant get uninstaller to work ?


Cant get uninstaller to work ?
Hi all, plz help me with this problem ?

my script is so far like this:

; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Bobs Mappack 1.3"
!define PRODUCT_VERSION "1.3"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
SetCompressor /SOLID lzma
SetCompressorDictSize 64
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; MUI end ------
Name "${PRODUCT_NAME}"
OutFile "C:\Bobs Mappack 1.3.exe"
ShowInstDetails show
ShowUnInstDetails show
Function .onInit
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\GhostRecon.exe" "path"
StrCmp $R0 "" NotPresent Present
notpresent:
StrCpy $INSTDIR "$programfiles\Red Storm Entertainment\Ghost Recon\Mods"
MessageBox MB_OK "Path to ghost recon was not found, plz verify this path, or browse to ghost recon\mods\ and install"
goto done
present:
strcpy $instdir $R0\Mods
done:
functionend
Section "MainSection" SEC01
SetOutPath "$INSTDIR\Bobs Mappack 1_3"
SetOverwrite on
File /r "G:\Ghost Recon\mods\Bobs Mappack 1_3\*.*"
sectionend
Section -AdditionalIcons
CreateDirectory "$SMPROGRAMS\Bobs Mappack 1.3"
CreateShortCut "$SMPROGRAMS\Bobs Mappack 1.3\Bobs Mappack 1.3.lnk" "$INSTDIR\Remove_Bobs Mappack 1.3.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\Remove_Bobs Mappack 1.3.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\Remove_Bobs Mappack 1.3.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
Delete "$SMPROGRAMS\Bobs Mappack 1.3\Bobs Mappack 1.3.lnk"
rmdir "$SMPROGRAMS\Bobs Mappack 1.3"
rmdir "$INSTDIR"
Delete "$INSTDIR\Remove_Bobs Mappack 1.3.exe"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
SetAutoClose true
SectionEnd

But no matter what i enter in the:
Section Uninstall
Delete "$SMPROGRAMS\Bobs Mappack 1.3\Bobs Mappack 1.3.lnk"
rmdir "$SMPROGRAMS\Bobs Mappack 1.3"
rmdir "$INSTDIR" :mad:"*Here is the problem"
Delete "$INSTDIR\Remove_Bobs Mappack 1.3.exe"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
SetAutoClose true
SectionEnd

rmdir "$instdir" , i tried delete "$instdir" and delete "$instdir/Bobs Mappack 1_3" and rmdir "$instdir/Bobs Mappack 1_3" and rmdir "$instdir", but it wont remove the directory, rest of the script is working so far ??? section in start menu is removed, and uninstaller is removed, but not the actual folder ?


Have you tried using just: RMDIR /r "$INSTDIR"


ill try that :-) ty


wow, i tried that and it removed all files in the mods folder :-), i only wanna remove the files/ folders i installed :-)


so maybe RMDIR /r "$instdir"\Bobs Mappack 1_3" will do, ill try that too :-)


yes, that did the trick, ty alot for the swift answer, ur the hero of the day :-)