PDA

View Full Version : Temporary Directory (NSTemporaryDirectory)




mdeh
Feb 10, 2009, 08:33 PM
A rather dumb but hopefully easy question.

Does the OS keep a TemporaryDirectory at all times.

So the call;

tempDir = NSTemporaryDirecory;

simply returns an existing Directory?


Once the programmer is done with this, does it have to be deleted?

Thanks



larkost
Feb 10, 2009, 09:40 PM
A quick look at the documentation indicates that this returns the user temporary items folder in /private/var/tmp/folders. This does not get erased on reboot, and is available to all processes running as that user. So you should create a directory inside that (or in /tmp if you want it to go away even if you crash) and then remove it at the end of your run.

mdeh
Feb 10, 2009, 10:50 PM
A quick look at the documentation indicates that this returns the user temporary items folder in /private/var/tmp/folders. This does not get erased on reboot, and is available to all processes running as that user. So you should create a directory inside that (or in /tmp if you want it to go away even if you crash) and then remove it at the end of your run.


Thanks larkost.

When you say "a quick look at the documentation", where exactly did you look. The documentation to a newbie can be pretty daunting.