mozilla/rust — pull request #3237 by dbp (2012-08-21 02:10:51+00:00)
Title: core: adding os::tmpdir() that returns a system temporary directory if it can find one

This should be cross platform, but I have no access to a windows machine to test! So, I can confirm that it works on *nix, and it should work on windows (it doesn't do anything fancy).

The only part that isn't great is that it is guaranteed to return on *nix and not on windows. I was basing this off of haskell's System.Directory.getTemporaryDirectory, and what they do for the windows version is return the Windows directory if none of the env. variables are set, and doing this they can always return a directory.

If we copied that behavior, the signature could change to reflect that it always gives back a Path, which might be desirable. I don't know how to get the Windows directory, and have no way to test, so I don't think I'm the person to add that, but I would support it happening.