On Thu, Feb 19, 2009 at 10:36 AM, Michael Ash <michael....@gmail.com> wrote:

> On Thu, Feb 19, 2009 at 9:15 AM, Michael <m...@comcast.net> wrote:
> > My question, having seen that the author creates and then stores these
> > unique names in the NSTemporaryDirectory, is **why** one would choose
> that
> > directory over, say, some locally created directory..is there a good OOP
> > reason for choosing that Foundation directory?  Unless I have missed
> > something, ( quite probably) the documentation does not specifically
> discuss
> > this aspect...but if it does...I will gladly read that if available.
>
> Nothing to do with OOP, it's just good practice on the system.
> Temporary files go in the temporary directory. There are several
> reasons why this is a good idea:
>
> - The temporary directory gets cleaned out regularly by the system. If
> you forget to delete the file or your app crashes or something else
> like that goes wrong, your temporary file won't sit around on the
> user's HD forever taking up space.
>
> - It's hidden and out of the way, so users aren't bothered by seeing
> temporary files they don't care about pop up in their home directory
> somewhere.
>
> - It's local even when the home directory itself is not. For example,
> if the user's home directory is stored on a network server, it's
> wasteful to put temporary files on that network server too when
> they're only needed locally.


And, of course, there's a very good meta-reason - you gain all of the above
benefits without having to write, debug, or maintain the relevant code
yourself. Apple already wrote it, so why reinvent that wheel?

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to