Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NIOFileSystem
: Try ${TMPDIR} first for temporary directory (#3067)
### Motivation: This PR aligns what temp directory NIOFileSystem will return first: - First try `${TMPDIR}` as it's an expressed user preference - On Darwin, try `_CS_DARWIN_USER_TMP_DIR` next. If it's set, return that. - Finally, fall back on `/tmp` on Darwin and Linux, and `/data/local/tmp` on Android. Closes #2861. ### Modifications: - Reworks `NIOFileSystem.temporaryDirectory`. ### Result: - NIOFileSystem will now try `${TMPDIR}` first for the temporary directory. ### Caveats: - We might want to align how Swift-NIO and FoundationEssentials resolve temp directory, and [FoundationEssentials have a different approach](https://github.com/swiftlang/swift-foundation/blob/9d57f36de757b3d5e3a2f7ffcf27aaec3033509f/Sources/FoundationEssentials/String/String%2BPath.swift#L484-L533). But, I agree with [this comment](#2861 (comment)), it feels like TMPDIR is an expected default. --------- Co-authored-by: Cory Benfield <[email protected]> Co-authored-by: George Barnett <[email protected]>
- Loading branch information