glib

Function tmp_dir

Source
pub fn tmp_dir() -> PathBuf
Expand description

Gets the directory to use for temporary files.

On UNIX, this is taken from the TMPDIR environment variable. If the variable is not set, P_tmpdir is used, as defined by the system C library. Failing that, a hard-coded default of “/tmp” is returned.

On Windows, the TEMP environment variable is used, with the root directory of the Windows installation (eg: “C:") used as a default.

The encoding of the returned string is system-defined. On Windows, it is always UTF-8. The return value is never None or the empty string.

§Returns

the directory to use for temporary files. Gets the directory to use for temporary files.

On UNIX, this is taken from the TMPDIR environment variable. If the variable is not set, P_tmpdir is used, as defined by the system C library. Failing that, a hard-coded default of “/tmp” is returned.

On Windows, the TEMP environment variable is used, with the root directory of the Windows installation (eg: “C:") used as a default.

The encoding of the returned string is system-defined. On Windows, it is always UTF-8. The return value is never None or the empty string.

§Returns

the directory to use for temporary files.