techno
techno

Reputation: 6500

Get Default Temporary Folder in Mac using Mono

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?

Upvotes: 3

Views: 2391

Answers (1)

Utsav Chokshi
Utsav Chokshi

Reputation: 1395

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"?

Upvotes: 4

Related Questions