c# - Path.GetTempPath() always returns %USERPROFILE% -
i've written program calls system.io.path.gettemppath()
function. documentation i've read (like one) says function should return first path found list:
- the path specified tmp environment variable.
- the path specified temp environment variable.
- the path specified userprofile environment variable.
- the windows directory.
i have defined both tmp
, temp
environment variables %userprofile%\appdata\local\temp
, call gettemppath()
returns %userprofile%
directory instead of values i've define tmp
, temp
. how can function return temporary directory i've defined?
that environment setting. http://msdn.microsoft.com/en-us/library/77zkk0b6.aspx
var tmp = environment.getenvironmentvariable("tmp");
update: went command prompt , did
set tmp=c:\temp
then launched visual studio command prompt. environment updated , visual studio sees it. code above (as yours) worked me. displayed updated environment settings.
so believe have kill explorer or logoff in order new environment seen permenantly.
Comments
Post a Comment