Re: temporary files and subsequent cleanup
Re: temporary files and subsequent cleanup
- Subject: Re: temporary files and subsequent cleanup
- From: Alastair Houghton <email@hidden>
- Date: Fri, 26 Oct 2007 17:35:45 +0100
On 26 Oct 2007, at 17:25, Steve Madsen wrote:
If you are only storing files during a single run of your
application (not between runs), you aren't sharing the files with
anything else, you have a small number of temporary files AND you
can keep them open at all times, you can probably use an old UNIX
trick to ensure that they are always removed, even if your
application crashes. After opening the file, unlink it, and don't
close the file handle. The file is gone as far as anything else is
concerned, but your app can still read and write to it. As soon as
the last file handle is closed, the file really goes away.
I haven't tested this on OS X, but it works on the UNIXes I'm
familiar with.
Yes, it works fine on OS X. The actual implementation in terms of
the filesystem is a bit freaky because HFS+ was never really designed
to support those semantics, but it does work.
All of this is thoroughly off topic, of course, but since most people
have time to kill until we can talk about Leopard I'm not sure anyone
will really care :-)
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden