What's the difference between these two methods of getting the system's temp dir?

Viewed 56
1 Answers

Directory.systemTemp is on iOS at least the more correct path than using path_provider's getTemporaryDirectory() function!

They are very different in how they function.

The Directory.systemTemp; variable returns the /tmp folder for iOS for instance whereas the getTemporaryDirectory() function returns the /Library/Caches value.

If you tried natively in Swift on iOS to get the temporary directory using this code

print(FileManager.default.temporaryDirectory)

You would get the /tmp/ function, which is what the Directory.systemTemp variable returns so this should be the way to go.

Related