From 31e519463822cf50dd136383d337480f89c9f040 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sat, 6 Aug 2022 15:25:20 +0100 Subject: [PATCH] env::temp_dir returns /private/tmp on Apple instead while /tmp is a symlink in fact. ref #99608 --- library/std/src/sys/unix/os.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index 46545a0839fe8..1ebd909f52a93 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -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") }