site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Are there other locations and are there any suggested usage policies? -- Greg Parker gparker@apple.com Runtime Wrangler _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Andre-John Mas wrote: I am try to find out what the right place is to save a temporary file on the Mac is. I have looked at the following places: /tmp ~/Library/Caches/<app name> To elaborate: what I am looking at is a file to be downloaded by a web browser, in order to directly be opened up by another application. In order for the other application to have access to it I will have to save it somewhere, though I am not sure where I should be saving it and what sort of life-span this file should have on the user's hard- disk. Good options include the following. The "right" choice depends in part on the auto-deletion policy you want. confstr(_CS_DARWIN_USER_TEMP_DIR, ...) confstr(_CS_DARWIN_USER_CACHE_DIR, ...) NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory, NSUserDomainMask, ...) _CS_DARWIN_USER_TEMP_DIR is a temp directory. Files there are deleted if they are not accessed after a few days. _CS_DARWIN_USER_CACHE_DIR is a cache directory. Files there survive longer than those in USER_TEMP_DIR, but may be deleted during OS upgrades or safe boot, for example. NSDownloadsDirectory is ~/Downloads (probably), which is the same download location that Safari uses by default. Files there are not automatically deleted. The confstr() directories are on the local disk (probably), while NSDownloadsDirectory and ~/Library/Caches may be on a slower network home directory. All of these are per-user directories, while /tmp and /Library/Caches are shared among all users which can cause security problems if you're not careful. This email sent to site_archiver@lists.apple.com