Skip to content

Commit

Permalink
env::temp_dir returns /private/tmp on Apple instead while /tmp is
Browse files Browse the repository at this point in the history
a symlink in fact.

ref rust-lang#99608
  • Loading branch information
devnexen committed Aug 6, 2022
1 parent 2a990f7 commit 31e5194
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/std/src/sys/unix/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,9 @@ pub fn temp_dir() -> PathBuf {
crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| {
if cfg!(target_os = "android") {
PathBuf::from("/data/local/tmp")
} else if cfg!(target_vendor = "apple") {
// on Apple devices, /tmp is a symlink
PathBuf::from("/private/tmp")
} else {
PathBuf::from("/tmp")
}
Expand Down

0 comments on commit 31e5194

Please sign in to comment.