This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tl;dr: FileManager.default.url(for:in:appropriateFor:create:) has unexpected behavior in Simulator and creates temporary folders outside the tmp/ directory. | |
let tmpDirClassic = NSTemporaryDirectory() | |
print("tmpDirClassic: \(tmpDirClassic)") | |
// This is the same code, just syntax sugar for NSTemporaryDirectory() | |
// https://github.com/apple/swift-corelibs-foundation/blob/master/Foundation/FileManager.swift#L1420-L1422 | |
let tmpDirClassicNewShim = FileManager.default.temporaryDirectory | |
print("tmpDirClassicNewShim: \(tmpDirClassicNewShim)") | |
// Simulator: /Users/steipete/Library/Developer/CoreSimulator/Devices/31C05637-B9C9-482C-A6CE-D063A7CECF64/data/Containers/Data/Application/A68D11A4-88BA-4FCF-A8B1-D102945D0740/tmp/ |