Skip to content

Commit 0d4d752

Browse files
authored
Correct doc about temp_dir() behavior on Android
Since commit aosp-mirror/platform_frameworks_base@d5ccb03, `TMPDIR` will be set to application's cache dir when app starts.
1 parent 28b83ee commit 0d4d752

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: library/std/src/env.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,9 @@ pub fn home_dir() -> Option<PathBuf> {
668668
/// On Unix, returns the value of the `TMPDIR` environment variable if it is
669669
/// set, otherwise the value is OS-specific:
670670
/// - On Android, there is no global temporary folder (it is usually allocated
671-
/// per-app), it returns `/data/local/tmp`.
671+
/// per-app), it will return the application's cache dir if the program runs
672+
/// in application's namespace and system version is Android 13 (or above), or
673+
/// `/data/local/tmp` otherwise.
672674
/// - On Darwin-based OSes (macOS, iOS, etc) it returns the directory provided
673675
/// by `confstr(_CS_DARWIN_USER_TEMP_DIR, ...)`, as recommended by [Apple's
674676
/// security guidelines][appledoc].

0 commit comments

Comments
 (0)