Skip to content

Commit 31e5194

Browse files
committed
env::temp_dir returns /private/tmp on Apple instead while /tmp is
a symlink in fact. ref rust-lang#99608
1 parent 2a990f7 commit 31e5194

File tree

1 file changed

+3
-0
lines changed
  • library/std/src/sys/unix

1 file changed

+3
-0
lines changed

library/std/src/sys/unix/os.rs

+3
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,9 @@ pub fn temp_dir() -> PathBuf {
586586
crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| {
587587
if cfg!(target_os = "android") {
588588
PathBuf::from("/data/local/tmp")
589+
} else if cfg!(target_vendor = "apple") {
590+
// on Apple devices, /tmp is a symlink
591+
PathBuf::from("/private/tmp")
589592
} else {
590593
PathBuf::from("/tmp")
591594
}

0 commit comments

Comments
 (0)