Old 25th May 2006, 08:53   #1
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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
shaunb is offline   Reply With Quote
Old 25th May 2006, 09:10   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
What does $CFDIR contain?

-Stu
Afrow UK is offline   Reply With Quote
Old 25th May 2006, 09:14   #3
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
e:\cfusionMX7

the location of the ColdFusionMX7 install
shaunb is offline   Reply With Quote
Old 25th May 2006, 09:21   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 25th May 2006, 09:30   #5
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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.

shaunb is offline   Reply With Quote
Old 25th May 2006, 09:51   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
What happens if you try and delete the undeleted folders yourself further down in the script (with RMDir).

-Stu
Afrow UK is offline   Reply With Quote
Old 25th May 2006, 09:52   #7
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
let me try deleting $INSTDIR somewhere else. a minute
shaunb is offline   Reply With Quote
Old 25th May 2006, 09:55   #8
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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!
shaunb is offline   Reply With Quote
Old 25th May 2006, 09:56   #9
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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.
shaunb is offline   Reply With Quote
Old 25th May 2006, 09:57   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I don't mean $INSTDIR, but the highest level folder in it that wasn't deleted.

-Stu
Afrow UK is offline   Reply With Quote
Old 25th May 2006, 10:01   #11
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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
shaunb is offline   Reply With Quote
Old 25th May 2006, 11:16   #12
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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
shaunb is offline   Reply With Quote
Old 25th May 2006, 11:19   #13
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
${Locate} the remaining directories and remove them one by one :-)

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 25th May 2006, 11:21   #14
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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.
shaunb is offline   Reply With Quote
Old 25th May 2006, 11:26   #15
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
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. :-)

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 25th May 2006, 11:54   #16
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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
shaunb is offline   Reply With Quote
Old 25th May 2006, 12:20   #17
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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)
shaunb is offline   Reply With Quote
Old 25th May 2006, 14:16   #18
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Please attach your script. Also, which NSIS version are you using?

-Stu
Afrow UK is offline   Reply With Quote
Old 25th May 2006, 15:46   #19
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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.
shaunb is offline   Reply With Quote
Old 25th May 2006, 15:48   #20
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
In which case, send it to afrowuk [at] tiscali [dot] co [dot] uk

-Stu
Afrow UK is offline   Reply With Quote
Old 25th May 2006, 15:59   #21
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
will do, dont tell anybody though *touches nose*
shaunb is offline   Reply With Quote
Old 25th May 2006, 16:02   #22
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
sent
shaunb is offline   Reply With Quote
Old 26th May 2006, 13:52   #23
shaunb
Member
 
Join Date: May 2006
Location: Devon, UK
Posts: 65
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!
shaunb is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump