Archive: abort function woes


abort function woes
I dont expect anyone to just magically know why my $INSTDIR isnt fully being deleted, I've tried moving all file handles off it before cleaning up, etc. I dont get why it leaves behind 6 directories in $INSTDIR, all empty, plus , its very odd to me that none of these directories were used or referenced or allocated a file handle etc.

the whole $INSTDIR is empty too (0 bytes total), but has a subtree still existing with these 5 directories and their relevant subdirs, it cleans up $TEMP and other install locations fine, just not $INSTDIR, as I said before I've setoutpath to somewhere other than $INSTDIR before cleaning up.

any clues would be appreciated although I know someone can't just magically know, well maybe.

thanks people.

Function .onAbort
# stale file handles would stop something being deleted
RMDir /r "$CFDIR\customtags\icm"
SetOutPath $CFDIR
RMDIR /r "$INSTDIR"
RMDIR /r $INSTDIR
RMDIR $INSTDIR
RMDir /r "$TEMP\${gossTemp}"
Delete $TEMP\testlogin*
Delete c:\adminapi.log
RMDir /r "c:\inetpub\wwwroot\web"
SetOutPath $TEMP
FunctionEnd

edit: yeah, I know theres 3 rmdirs for instdir in there but that was merely me testing stuff :)


What does $CFDIR contain?

-Stu


e:\cfusionMX7

the location of the ColdFusionMX7 install


In which case, SetOutPath $CFDIR will probably fail if E:\ is a CD drive because it is not a writable path.
Try using SetOutPath $TEMP.

-Stu


its not the cdrom drive, :) its the location of the installed CF.

I place some files in $CFDIR\customtags\ but .onAbort cleans up $CFDIR absolutely fine.

its just $INSTDIR that leaves behind 6 directories, with subdirs, that I didn't even use or reference in the install, very odd, I mean directories that I DID reference got deleted ok.

:(


What happens if you try and delete the undeleted folders yourself further down in the script (with RMDir).

-Stu


let me try deleting $INSTDIR somewhere else. a minute


I called it in my tidy function that is executed within

!define MUI_PAGE_CUSTOMFUNCTION_SHOW "FinishShow"

and , it leaves the same directories behind exactly.

hmm!


ah sorry , I misunderstood, I can delete the directories inside, but I'd only want to delete them onabort, as they are the actual files I'd want to install! hehe.

I'll try deleting them individually in the abort function a minute.


I don't mean $INSTDIR, but the highest level folder in it that wasn't deleted.

-Stu


I tried deleting the subdirs individually in my .onAbort but they dont delete.

Function .onAbort
# stale file handles would stop something being deleted
RMDir /r "$CFDIR\customtags\icm"
RMDIR /r "$INSTDIR"
RMDir /r "$TEMP\${gossTemp}"
Delete $TEMP\testlogin*
Delete c:\adminapi.log
RMDir /r "c:\inetpub\wwwroot\web"
SetOutPath $TEMP
RMDIR /r "$INSTDIR"
RMDIR /r "$INSTDIR\cache"
RMDIR /r "$INSTDIR\icm"
RMDIR /r "$INSTDIR\media"
# why doesnt this delete $INSTDIR fully?
# it leaves behind completely irrelevant folders that we didnt even use in the installation
FunctionEnd


I've tried NSExec'ing a batchfile with:

rmdir /q/s %1

and then calling it with $INSTDIR as the parameter, but no such luck


${Locate} the remaining directories and remove them one by one :-)


I am thinking about that you know hehe, I've already closed the locate plugin by that point as I use it earlier in the install, but yeah, its not a bad idea at all.


RmDir /r could cause an unwanted removal by accident.
It's better, when you know that your installation creates files/directories on target that you want to clean up, to ${Locate} them and remove them by the safe way. :-)


Hi, again, I've tried this and it leaves the same folders from before, there MUST be something saying that I cannot delete it, but I'm unsure as to what as I never referenced any of these dirs inside the $INSTDIR.

its funny how the subdir I make in $TEMP cleans up perfectly and I was referencing that all the way through, and running various things from that location. anyway, heres my code, I know theres an RMDIR and a Delete, I was just trying things out, seems I can't get the locate method to work for me either, I use the locate method in the same way to set file permissions for the whole subtree, so I'm stumped :(


Function delete
# callback function for locate, just delete current file
Delete $R9
RMDir $R9
Push $0
FunctionEnd

# custom abort function, called on setup abort
Function .onAbort
# stale file handles would stop something being deleted
RMDir /r "$CFDIR\customtags\icm"
RMDir /r "$TEMP\${gossTemp}"
Delete $TEMP\testlogin*
Delete c:\adminapi.log
RMDir /r "c:\inetpub\wwwroot\web"
SetOutPath $TEMP
# why doesnt this delete $INSTDIR fully?
# it leaves behind completely irrelevant folders that we didnt even use in the installation
RMDir /r $INSTDIR
${locate} "$INSTDIR" "/L=FD /M=*.*" "delete"
call unloadLocate
FunctionEnd


if I put a messagebox in the callback function displaying $R9, I can see the files locate finds, and they are the right ones.

however, calls to rmdir and delete do nothing .. woot!

(ponders to think what file handles are on the dirs, none)


Please attach your script. Also, which NSIS version are you using?

-Stu


I'm using NSIS 2.16

I'd love to attach my script but I think its out of company policy :(

sigh, it'd be nice of course if those rogue dirs would dissapear, everything else I tell to dissapear does, regardless of file handles used or whatever. :)


In which case, send it to afrowuk [at] tiscali [dot] co [dot] uk

-Stu


will do, dont tell anybody though *touches nose*


sent


Sorted, I moved the locate line to near the end of the finish page, and now it seems its working perfectly, I had it in a section before obviously being activated by the MUI_PAGE_INSTFILES page, maybe a handle was getting allocated there in the middle, who knows.

anyway it works great now, so thanks everyone for looking, now onto other issues hehe! :)