[Mono-osx] How to get OSX temp directory?

Emanuele Vulcano millenomi at gmail.com
Thu Jan 8 10:22:36 EST 2009

Temp folder names are randomized on OS X to prevent a certain class of  
attacks that can occur when files are placed in known-to-exist  
locations. That is indeed your temporary folder. IIRC temp folders are  
removed on reboot only on desktop versions of OS X.

Sent from the field; excuse the brevity -- ev

Il giorno 08/gen/09, alle ore 15:35, d_v  
<dan.vandermolen at figpsoft.com> ha scritto:

> Sounds like a good idea, though it gives me the temp path for the  
> current
> logged in user in Windows.
> But on my Mac Mini it gives some weird folder name that I am hoping  
> will be
> available for the session (at least 30 minutes) called:
> /var/folders/UL/ULVRjgWyF...+++TI/-Tmp/
> Does that sound correct?
> I was using System.Environment.GetEnvironmentVariable("TMP",
> EnvironmentVariableTarget.Machine)) because I thought it would be  
> best for
> all client computers and gives me a consistent temp location for my  
> windows
> services on all computers (Win 2000 and up)
> I also have a test application that is the same code but a win  
> form.  Now I
> am trying to convert both programs to work on mono on Mac OS X.
> But I will use this temp folder if a Mac computer and the other if a  
> Windows
> computer.  I wish I could use the same code though....
> PABLOSANTOSLUAC at terra.es wrote:
>> Why don't you just use:
>> Path.GetTempPath()
>> We do it with Plastic all the time.
>> d_v escribió:
>>> How do I get the system temp directory from a Mac?
>>> System.Environment.GetEnvironmentVariable("TEMP",
>>> EnvironmentVariableTarget.Machine)) works in Windows but not on  
>>> Mac OS X
>>> 10.5.6. and Mono 2.2. RC1
>>> I also tried "TMP", "tmp" but to no avail.
>>> I am trying to write on application for both Windows and Mac OS X.  
>>> (my
>>> first
>>> time)
>> _______________________________________________
>> Mono-osx mailing list
>> Mono-osx at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-osx
> -- 
> View this message in context: http://www.nabble.com/How-to-get-OSX-temp-directory--tp21337022p21352925.html
> Sent from the Mono - OSX mailing list archive at Nabble.com.
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx

More information about the Mono-osx mailing list