I think, those variables are not really standardized anyway. So it doesn't hurt to check for any of them. Whatever is found can probably be used as temp directory.