Deleting memory-mapped temporary files on Windows is turning out to be
a real bugger. Here’s a list of things which haven’t worked for me:
-
File.deleteOnExit() appears not to work on Windows all that well.
-
File.delete(). This fails when I do it directly.
-
Nulling all references to the MappedDataBufferInt, and running
System.gc() a bunch of times so that the files get unmapped, and then
calling File.delete(). -
All of the suggested work-arounds suggested by commenters on this bug:
bugs.sun.com/bugdatabase/view_bu … id=4724038
-
Runtime.addShutdownHook(), because it seems not to be called sometimes
on Windows, or at least seems not to be allowed to run to conclusion. -
Renaming the files, and then deleting them. Fails on the renaming.
I really don’t like the idea of leaving last session’s temp files to be
cleaned up by the next session—we should have VASSAL check for old temp
files to remove on startup, but I don’t want that to be the usual way
that temp files are removed.
Is it possible to spawn another process which will delete the temp files
after the main process has ended?
–
J.
Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org
Post generated using Mail2Forum (mail2forum.com)