When are folders made with GetTempDirPath deleted?

I'm writing a new button script and want to use GetTempDirPath to get a temporary folder which is automatically deleted.

According to the manual the temp folder should be deleted after either

  • 20 minutes when you define no time
  • the defined time
  • when restarting Opus (only valid when you also exit the taskbar icon?)

I created three folders with GetTempDirPath(1) with some minutes delay inbetween. It was something like 19:59 / 20:03 / 20:04.
These folders were not deleted after 1 minute and also not after restarting Opus. Suddenly at 20:12 all three were delete at the same time.

I have at the moment temp folders created at 19:58 with 20 minutes and 20:14 with 1 minute. Still existing now at 20:20.

Now I choose also exit in the taskbar icon and then the folders were deleted. But the deletion after a certain time seems not to work properly. Or were is the mistake?

The lifetime you specify is really a minimum, not an absolute time.

The folder will be cleaned up, if it's older than your specified time, the next time Opus runs its janitor thread to clean up temp files/folders. So it may exist for longer than specified.

If you need it deleted sooner than that, you should delete it yourself.

ok. thank you. In the manual its described that it is a defined lifetime, but not minimum lifetime (at least for my understanding). But thats also ok for me. :slight_smile: