3

I need my application to write buffer data to the temporary folder.When i used

System.IO.Path.GetTempPath()  

in Mac it returned a string

 var/folders/r3/blah..blah/T/ 

(blah.blah = some random letters and digits)

Where exactly is this folder located?

Doesn't Mac have a folder like Temp in windows to place the temporary files?

techno
  • 6,100
  • 16
  • 86
  • 192
  • 2
    It turns out that it is the temp folder for mac. Refer http://apple.stackexchange.com/questions/3949/how-do-i-find-out-the-system-temporary-directory – Sriram Sakthivel Mar 29 '15 at 09:29
  • @SriramSakthivel Sorry for the late response.Was busy with some other work.So this itself is the temp folder.So where is it located exactly? – techno Apr 01 '15 at 13:31

1 Answers1

4

Short answer :

For C#, Path.GetTempPath() function returns value stored in environment variable $TMPDIR. Value of $TMPDIR in general is of following form :

/var/folders/{2 character random-string}/{random-string}/T

Long answer

Mac OS stores system-wide temporary files at : /var/folder/../T

This path can be found out using environment variable $TMPDIR

Please note that /tmp or /var/tmp are also temporary directory but its data is usually deleted upon rebooting Mac OS.

Also, temporary directory depends upon what application you are using.

So, gist is there is no universal temp directory in mac os.

Check out this links for more details :

Where is the temp folder?

What is "/var/folders"?

Utsav Chokshi
  • 1,357
  • 1
  • 13
  • 35