FileClose not closing a file
Hi,
I have a temporary file used by my installer that I cannot delete. But I believe the delete is failing because it is not actually getting closed. The delete is setting the ErrorFlag, and the only thing I can think of is the file is not getting closed, thus preventing it from being deleted.
I have put a whole bunch of Message Boxes in my script to follow closely what is going on. If I use the OS to check the handle of my temp file, I see that nothing else has a hold of it except my installer program. If fact the installer program has a hold of it until I actually exit the installer, even though I request to close it and delete it. I am using v1.96, on W2K.
Here is the portion of my script:
SetOutPath $TEMP
GetTempFileName $7
MessageBox MB_OK "Temp file name is $7"
<snip... run program that will write errors to $7>
ClearErrors
; ConfigureJavaWebStart returned a non-zero error code.
ExceptionError:
MessageBox MB_OK "Error: Could not configure program. Please contact System Administrator"
MessageBox MB_OK "Looking for error file : $7"
IfFileExists $7 ErrorFileFound ErrorUnknown
ErrorFileFound:
MessageBox MB_OK "Error file found"
FileOpen $4 $7 "r"
IfErrors ErrorUnknown
StrCpy $6 ""
ErrorLoop:
FileRead $4 $5
IfErrors ErrorLoopDone
DetailPrint $5
StrCpy $6 "$6$5"
Goto ErrorLoop
ErrorLoopDone:
ClearErrors
FileClose $7
IfErrors CloseError CloseNoError
CloseError:
MessageBox MB_OK "Error: could not close file $7"
CloseNoError:
MessageBox MB_OK "ERROR: Could not configure JWS with correct JRE. Error is $6"
MessageBox MB_OK "Deleting file $7"
ClearErrors
Delete $7
IfErrors DeleteError DeleteNoError
DeleteError:
MessageBox MB_OK "Error deleting file $7"
DeleteNoError:
SetErrors
Goto InstallDone
Thanks for any help.
Beth