Is there a new temp path behaviour in ArcGIS 10.1?

3695
5
Jump to solution
08-21-2012 04:35 AM
FossiG_
New Contributor III
Hi,

apparently since version 10.1 ArcMap creates its own temporary folder in the systems temp path. One folder for each ArMap-Process. The folders created look like this (where ...\Temp\ represents the systems temp path aka %temp%).

...\Temp\arcB\
...\Temp\arc27\
...\Temp\arc29\
...\Temp\arc2B\

This itself would be no problem, but it looks like ArcMap also changes the systems %temp% environment variable for its process.

If an AddIn determines the temp path it no longer gets the systems path, but rather the temp-directory of the current ArcMap-process it was called from, eg. ...\Temp\arc27\ instead of ...\Temp\

c#-Snippet used in our AddIns:
string tempPath = System.IO.Path.GetTempPath();


Is there any way, to get the old behaviour back?

The new directory is not a problem but why must ArcMap dynamically change the %temp% environment variable?

TIA,
Fossi
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
As a workaround you can get the environment variables through a different call.

Compare the following outputs

MessageBox.Show("temppath: " + Path.GetTempPath());
MessageBox.Show(Environment.GetEnvironmentVariable("TEMP",EnvironmentVariableTarget.User));


Change EnvironmentVariableTarget to user, process or machine as required.
Hope this helps.

View solution in original post

0 Kudos
5 Replies
Mariannevon_den_Driesch
New Contributor
Hi,
we found the same problem and asked the ESRI Support for help.
We've received a response that this issue has been documented in ESRI Inc. now under NIM086862 "Incorrect temporary path is returned through add-in ArcGIS 10.1".
Under http://support.esri.com/ or http://resources.arcgis.com/en/home/ we should be able to track the status. Currently, we find there, however, no entry.
Kind regards,
geodok_dev
0 Kudos
by Anonymous User
Not applicable
As a workaround you can get the environment variables through a different call.

Compare the following outputs

MessageBox.Show("temppath: " + Path.GetTempPath());
MessageBox.Show(Environment.GetEnvironmentVariable("TEMP",EnvironmentVariableTarget.User));


Change EnvironmentVariableTarget to user, process or machine as required.
Hope this helps.
0 Kudos
Mariannevon_den_Driesch
New Contributor
Hello Sean,

thanks for the workaround, this solves my problem.

Kind regards,
Marianne
0 Kudos
FossiG_
New Contributor III
Hello Marianne, Hello Sean,

thanks for bringing this post up again.

Yes, the mentioned workaround avoids the problem. +1

BUT: It is very annoying, that any component executed in the context of an ESRI 10.1 Add-In suffers from this behaviour. I am using an external assembly as connector to another application. This assembly also gets this twisted path, when called from an ArcMap 10.1 Add-In. Executed from any other source, the temp path is correct.

So this problem goes beyond the Add-In itself and therefore this or any other workaround sadly has to be implemented in every dependent component, too. IMHO this is a bug.

Kind regards,
Fossi
0 Kudos
JonMorris2
Occasional Contributor II

This is still a bug in 10.3. I found it on the support site and status is still New, so we'll have to keep using the workaround.

NIM086862: Incorrect temporary path is returned through Add-In..

0 Kudos