Temporary Directory (NSTemporaryDirectory)

Discussion in 'Mac Programming' started by mdeh, Feb 10, 2009.

  1. macrumors 6502

    Joined:
    Jan 3, 2009
    #1
    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
     
  2. macrumors 6502a

    Joined:
    Oct 13, 2007
    #2
    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.
     
  3. thread starter macrumors 6502

    Joined:
    Jan 3, 2009
    #3

    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.
     

Share This Page