I have compared two files and stored mismatched values in the temporary file.After that read the values from temporary file and replaced in original file.
I have used following code
page custom twofilecompare
page custom originalwrite
Function twofilecompare
FileOpen $0 "$INSTDIR\backup.properties" "r"
FileOpen $1 "$INSTDIR\orginal.properties" "r"
FileOpen $R0 "$INSTDIR\temp.properties" "w"
ClearErrors
loop:
FileRead $0 $2
${If} $2 == "$\r$\n"
Goto loop
${EndIf}
FindClose $0
FileRead $1 $3
IfErrors done
strcmp $2 $3 loop here
here:
FileWrite $R0 $2
Goto loop
done:
FileClose $0
FileClose $1
FileClose $R0
FunctionEnd
Function originalwrite
IfFileExists "$INSTDIR\temp.properties" 0 filenotfound
FileOpen $0 "$INSTDIR\temp.properties" "r"
loop:
FileRead $0 $1
IfErrors done
//do some stuff
done:
FileClose $0
Delete /REBOOTOK "$INSTDIR\temp.properties"
filenotfound:
MessageBox MB_OK "file not found"
FunctionEnd
After installed I cant edit original and backup property file.If i try to modify a prompt box display as
"please check if this file opened another program".But i have closed all files.
How to find file is closed or not ?
How to solve this problem?
User cant modifiy the files after installed?
4 posts
You've got FindClose $0 in there - I'm guessing that should be FileClose?
Stu
Stu
Thanks.but i think no need for Findclose or Fileclose in that place.beacause i have closed all files in done section.
Yes, I was thinking the same thing.
Are you sure you've closed all open files? Try putting a messagebox after the fileopen commands, echoing the handles in $0 $1 and $R0. Then when you close them, put the same messagebox and check whether those registers still contain the same file handles. Maybe you accidentally changed the registers somewhere..
Are you sure you've closed all open files? Try putting a messagebox after the fileopen commands, echoing the handles in $0 $1 and $R0. Then when you close them, put the same messagebox and check whether those registers still contain the same file handles. Maybe you accidentally changed the registers somewhere..