2010
05.04

Environment variables are no secret and neither is the system-set “TEMP” variable, but what is not really mentioned in the SDK Docs is that Softimage overrides the TEMP and TMP environment variables with a temporary folder made by XSI:

If I run that (JavaScript) I get something like: C:\Users\Alan\AppData\Local\Temp\XSI_Temp_15076

The number is unique every time and if you open multiple XSI sessions, each will get their own temp folder. If you close Softimage, the corresponding temp folder is deleted completely.

This is a much more elegant solution to temporary filepaths because you don’t have to waste time coding a purging/cleanup mechanism in your plugin.

Furthermore, if Softimage crashes it will get cleaned anyways next time you run it. It seems to check for XSI_Temp_* folders on startup and delete any that are not in use by an existing session.

I found this feature by accident when I needed a temp file function for a scripted tool I was working on. I was expecting to get the normal TEMP path set by Windows, but to my surprise Softimage had overriden it with their own that autopurges by itself. Handy! 🙂

No Comment.

Add Your Comment