I am creating an installable extension for ArcMap using C#/WPF/VS2010. (which may or may not have any bearing here). One thing I would like to do is store data in the users temporary folder. So, I get the folder like so:
public static string SystemTempPath = Path.GetTempPath();
When I compile everything and Bind to the variable (indirectly) in the WPF designer I got this in the preview pane:
"C:\Users\<username>\AppData\Local\Temp\"
Great, thats what I am after. But when I run the extension in ArcMap I get something like the following:
"C:\Users\<username>\AppData\Local\Temp\arcA6C5\"
Note the extra folder at the end which changes every time I reload ArcMap. So it seems that since this is an extension and I am somewhat at the mercy of the ArcMap kernel, it is using ArcMap's created temp folder and not the user temp var.
My question: Is there a way to get around this grammatically other then a string manipulation? I could assume that this extra will always be there and simply truncate but this way seems somewhat dirty. I have tried this as well with the same result:
System.Environment.GetEnvironmentVariable("TEMP");
System.Environment.GetEnvironmentVariable("TMP");
Which would only be slightly less dirty anyway.
Thanks for any help.