0
votes

I am a newbie in writing an installer/uninstaller. I need an uninstaller to delete the files stored in the log file (text file). I am trying to implement the functionality using NSIS script but I couldn't though I followed the below link : http://nsis.sourceforge.net/Talk:Uninstall_only_installed_files Basically I need to implement the following four lines of code:

OutFile "dummy.exe" 
Section "Uninstall"
!include "unlist.txt"
!system 'del unlist.txt'
SectionEnd

The include statement shows an error as I've appended the file names with wrong format in unlist.txt .

Compilation result:

OutFile: "dummy.exe"
Section: "Uninstall"
!include: "unlist.txt"
File: "Test1.txt" [compress] 4 bytes
File: "Test2.txt" [compress] 0/4 bytes
File: "Test3.txt" [compress] 0/4 bytes
File: "Test4.txt" [compress] 0/4 bytes
!include: closed: "unlist.txt"
SectionEnd

Processed 1 file, writing output:

Error: invalid script: no sections specified
Error - aborting creation process

Can anyone advise me with a correct script or the correct format of file need to be mentioned in the unlist.txt ?

Thanks for your help.

Best Regards, Peter

1

1 Answers

4
votes

Your installer need to look at least like this:

OutFile "dummy.exe"

Section 01
# This is install section
WriteUninstaller "Uninstall.exe"
SectionEnd

Section "Uninstall"
!include "unlist.txt"
!system 'del unlist.txt'
SectionEnd

One install section must exists and simple uninstaller is created (in temp directory). You need to specify more code to work correctly: e.g. set $INSTDIR etc.