- NSIS Discussion
- NSIS does not delete a file that is told to delete
Archive: NSIS does not delete a file that is told to delete
n0On3
28th October 2002 19:10 UTC
NSIS does not delete a file that is told to delete
Well, I have a bit of a problem here. I tell nsis to delete a file and he does not delete it.:eek: It's a file that will be created while running the installation and the user has the choice beforehand to choose if the file will remain or not.
Well, I attach a zip with the program, the nsi file and a folder that is needed to run the program.
kichik
28th October 2002 19:30 UTC
Try using the latest CVS version, it works for me when I compile it with it.
n0On3
28th October 2002 23:50 UTC
and the exe included, does work for you?
kichik
29th October 2002 14:15 UTC
The included EXE doesn't delete the file, the EXE I compiled using the latest CVS version does.
n0On3
29th October 2002 18:02 UTC
I am trying to do something in this CVS folder but downloading makensis.exe and makensisw.exe and try to compile gives error on line 1.
Let's see if you can help me another bit.:)
rainwater
29th October 2002 19:05 UTC
Originally posted by n0On3
I am trying to do something in this CVS folder but downloading makensis.exe and makensisw.exe and try to compile gives error on line 1.
Let's see if you can help me another bit.:)
Download the snapshot. The link to it is in my signature.
n0On3
30th October 2002 00:50 UTC
well, I've downloaded the snapshot and installed it. And then make a new compilation, and then run it, and then find that that ini file is still there:(
Sometimes just the file remains there. Sometimes it appears after two seconds (more or less) of clicking on "Close".
I attached a zip with nsi, new compilation and that log folder.
kichik
30th October 2002 14:14 UTC
The compiled installer inside your ZIP file deletes the file for me.
What OS are you using?
n0On3
30th October 2002 14:36 UTC
I am using Win98SE.
kichik
30th October 2002 15:31 UTC
On Windows 98 it happens to me too, I will look into it.
n0On3
30th October 2002 16:04 UTC
Thanks.
Sometimes the .ini appears clearly after those .csv files, which in the script are created after the .ini.
Maybe the problem is that the file to delete is created in the same installation.
Another thing is that I didn't find how to create the file, so I used FileOpen directly.
kichik
6th November 2002 15:41 UTC
OK, here is what I think happens:
I think that when you call WriteINIStr Windows delays write it. That means, it writes to the file whenever it feels like it, or before someone wants to read from it.
In your case you always write just before you delete it, and you don't read in between, so Windows delays the writing.
Windows 95/98/Me: The DeleteFile function deletes a file even if it is open for normal I/O or as a memory-mapped file. To prevent loss of data, close files before attempting to delete them.
So after you have already deleted it, Windows' WriteINIStr remembers it needed to write something and it recreates the file for it. What you need to do is to flush the file buffers before you delete it using:
WriteINIStr
"${TMP}"""""""
It worked for me 10 out of 10 times so I guess I am correct :D
n0On3
6th November 2002 18:22 UTC
I understand that I have to write that line just before deleting the ini file.
I tried but It didn't work, could you upload the modified ini with a compile that works for you?
Thanks:)
kichik
6th November 2002 18:28 UTC
There it is.
n0On3
7th November 2002 04:04 UTC
Sorry, but it didn't work. The file is still there.
It deletes the file when making a pause with messagebox.
In the first try the ini appeared after presssing F5.
n0On3
8th November 2002 00:36 UTC
ok kichik, I am your worst nightmare.:eek:
That makensis you gave me does indeed delete the ini, but when working it keeps it at zero bytes, for easy deleting, of course.:)
I attach the compiled script, the script and logs, as always.:)
kichik
8th November 2002 11:16 UTC
Oops... Fixed that in the latest CVS version. You will have to compile again.