#303 fileutil::tempdir on windows

open
nobody
fileutil (15)
5
2008-11-29
2008-11-29
Anonymous
No

As the manual states, on windows, the following locations are checked in step 5 of the process in determining the location for temp files:
"...C:\TEMP, C:\TMP, \TEMP, and \TMP are tried in that order..."
I think, usually there are no such dirs on windows. If a process runs without a logged on user (in the system context), the directiory usually is %systemroot%\temp (which is c:\windows\temp or c:\winnt\temp, e.g.), otherwise, the temp dir is normally somewhere in the current user's profile path, to where the TMP-Var points. In generall, it's not 100% safe to rely on environment variables - I think it would be more foolproof to ask the system via API call about the right location...

Discussion