Archive: NSIS does not delete a file that is told to delete


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.


Try using the latest CVS version, it works for me when I compile it with it.


and the exe included, does work for you?


The included EXE doesn't delete the file, the EXE I compiled using the latest CVS version does.


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.:)


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.

http://forums.winamp.com/showthread....hreadid=102204


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.


The compiled installer inside your ZIP file deletes the file for me.
What OS are you using?


I am using Win98SE.


On Windows 98 it happens to me too, I will look into it.


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.


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

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:)


There it is.


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.


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.:)


Oops... Fixed that in the latest CVS version. You will have to compile again.