NSIS Exec uninstaller
I have a simple installer and uninstaller which will write log to a text file
When the installer run, it will check the install file existence. If it exists, it will run the uninstaller. The installer and uninstaller run perfect. However, auto uninstall will not write to the log file. The uninstaller will write to log file if involked alone. Please find my code below.
Thanks for any help!
${If} ${FileExists} `$INSTDIR\PSS.jar`
MessageBox MB_YESNO "PSS.jar already exists$\r$\nDo you want to uninstall that?" IDYES AutoUninstall
${Else}
MessageBox MB_OK "No previous version found. Continue with installer"
Install:
;Set the output path to the installation directory $InstallDir
SetOutPath $INSTDIR
; Put files to be copied in this section
File PSS.jar
WriteUninstaller $INSTDIR\UninstallPSS.exe
FileOpen $4 c:\log\PX.log a
FileSeek $4 0 END
FileWrite $4 "PSS.jar V1.2 installed$\r$\n"
FileClose $4
${EndIf}
Goto End
AutoUninstall:
ExecShell "" "UninstallPSS.exe"
Goto Install
End:
SectionEnd
; Uninstall
Section "Uninstall"
Delete $INSTDIR\PSS.jar
Delete $INSTDIR\UninstallPSS.exe
FileOpen $4 C:\log\PX.log a
FileSeek $4 0 END
FileWrite $4 "PSS.jar V1.2 uninstalled$\r$\n"
FileClose $4
SectionEnd