Re: Question about the Foundation Framework
Re: Question about the Foundation Framework
- Subject: Re: Question about the Foundation Framework
- From: Michael <email@hidden>
- Date: Thu, 19 Feb 2009 08:19:05 -0800
Thank you Mike,
that's what I was looking for.
Michael.
On Feb 19, 2009, at 7:36 AM, Michael Ash wrote:
On Thu, Feb 19, 2009 at 9:15 AM, Michael <email@hidden> 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.
If these reasons don't fit your needs then of course you can store
files elsewhere instead, but those are the reasons why one would use
NSTemporaryDirectory.
If you're looking for more information, note that NSTemporaryDirectory
is essentially equivalent to /tmp on a normal UNIX system, although
it's actually in a different location.
Mike
_______________________________________________
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