core: adding os::tmpdir() that returns a system temporary directory if it can find one #3237
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.