Closed acecilia closed 4 years ago
PathKit is doing the same: https://github.com/kylef/PathKit/blob/c8f12353bca8c252713fd2e2fbc5789c39ff92f8/Sources/PathKit.swift#L475
Do you prefer the following alternative, as explained by the docs you linked?:
let temporaryDirectory = try FileManager.default.url(
for: .itemReplacementDirectory,
in: .userDomainMask,
appropriateFor: URL(fileURLWithPath: "/"),
create: true
)
Apple are pretty clear that:
appropriateFor: URL(fileURLWithPath: "/")
Is not acceptable. The only way we should add this would be to make it a function that accepts a path so as to determine the URL correctly. This is certainly not as elegant, but I do not want to encourage people to use this library in a way that opens them up to unexpected issues.
https://developer.apple.com/documentation/foundation/1409211-nstemporarydirectory
So, really, we should not offer this.