Im new to NSIS but i have made som installers.
But now im trying to make so only the installed files gets uninstalled. I found this
But then my uninstallers uninstalls I stops then i trys to delete the folder. For example: then the uninstaller trys to uninstall INSTDIR\direxample the uninstallers stop and does nothing.
whats wrong with the code? If I skip to install that section that dosent work an other one makes it stop 🙁
Here is the code for one section that dont work:
Section "FGDs" SEC02
${AddItem} "$INSTDIR\fgd"
${SetOutPath} "$INSTDIR\fgd\counter-strike"
${File} "C:\Documents and Settings\Jocke\Skrivbord\Baafens mapp\instaler\Mapping\instalfiler\FGD\fgd\counter-strike\" "cs_expert-tom793c.fgd"
${File} "C:\Documents and Settings\Jocke\Skrivbord\Baafens mapp\instaler\Mapping\instalfiler\FGD\fgd\counter-strike\" "halflife-cs_expert.fgd"
${SetOutPath} "$INSTDIR"
${File} "C:\Documents and Settings\Jocke\Skrivbord\Baafens mapp\instaler\Mapping\instalfiler\" "Readme Baafen VHETOOLS Pack.txt"
SectionEnd
and this is how the uninstall sections looks like:
Section -closelogfileI have attached the script/code so you can take a look at the whole script and see if you can find anny wrong with it.
FileClose $UninstLog
SetFileAttributes "$INSTDIR\${UninstLog}" READONLY|SYSTEM|HIDDEN
SectionEnd
Section Uninstall
; Can't uninstall if uninstall log is missing!
IfFileExists "$INSTDIR\${UninstLog}" +3
MessageBox MB_OK|MB_ICONSTOP "$(UninstLogMissing)"
Abort
Push $R0
Push $R1
Push $R2
SetFileAttributes "$INSTDIR\${UninstLog}" NORMAL
FileOpen $UninstLog "$INSTDIR\${UninstLog}" r
StrCpy $R1 0
GetLineCount:
ClearErrors
FileRead $UninstLog $R0
IntOp $R1 $R1 + 1
IfErrors 0 GetLineCount
LoopRead:
FileSeek $UninstLog 0 SET
StrCpy $R2 0
FindLine:
FileRead $UninstLog $R0
IntOp $R2 $R2 + 1
StrCmp $R1 $R2 0 FindLine
StrCpy $R0 $R0 -2
IfFileExists "$R0\*.*" 0 +3
RMDir $R0 #is dir
Goto +3
IfFileExists $R0 0 +2
Delete $R0 #is file
StrCmp $R1 0 LoopDone
IntOp $R1 $R1 - 1
Goto LoopRead
LoopDone:
FileClose $UninstLog
Delete "$INSTDIR\${UninstLog}"
Pop $R2
Pop $R1
Pop $R0
SectionEnd
EDIT: Now I have another problem to. I have 4 things that can be installed with the installer. But I cant uninstall if the first of them is installed. Its says that it cant find the uninstal log. Again see the attached code.
EDIT Agian: Now I saw that then the uninstallers just stop The folder that it trys to remove is removed. Only 2 files is left and that is the uninstaller and the log that the uninstaller uses, How can I fix this?
// Sorry for my bad english I hope you understand