DzApp.getTempFilename() doesn't seem to clean-up after itself.
Hello All,
According to the documentation, DzApp.getTempFilename() should clear up any files in the temp_dirs it creates when Daz shuts down. Unfortunately, this doesn't seem to be the case. I've worked around this by keeping track of the temp dirs that are created in my script and then before my script ends, I clear them up with the following code:
for(var i = 0; i < app_temp_dirs.length; i++) { // remove files in dirs var dir_to_nuke = DzDir(app_temp_dirs[i]); var files = dir_to_nuke.getFilesFromDir(["*.*"], true); for(var f = 0; f < files.length; f++) { dir_to_nuke.remove(files[f]) } // remove dirs dir_to_nuke.rmpath(app_temp_dirs[i]); }
The files get removed perfectly. However, any call to DzDir.rmpath(path_to_remove) that I try fails. Which means I'm left with a ton of empty dir structures.
I have tried relative paths, absolute paths, I've used DzDir.cdUp() to maybe get out of the way. etc. etc. etc. But I can't get it to work.
Would some kind soul put me out of my misery and tell me how it's done?
Comments
The docs say that files in the 'current temporary working folder' will be deleted when shutdown() is called.
If I create some files in this 'current temporary working folder' they are indeed deleted when DS is shut down. Subfolders within this folder, and files within those subfolders, do not appear to be affected.
ETA: Creation and removal of a folder (must be empty).
Thnx for your efforts. Will give it all a go over the weekend :)