What would be the easiest way to find the temporary file directory on Windows (The equivalent of /tmp
on Unix-like OSes)? Is it saved on an environment variable, or is it always a specific one? I want to find it for a Rust crate, so Rust-only answers. If possible I'd like to avoid anything but the std
crate.
CodePudding user response:
std::env::temp_dir()
returns a path to the system temporary directory. According to the docs when this answer was posted,
On Windows, the behavior is equivalent to that of
GetTempPath2
/GetTempPath
, which this function uses internally.