Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Revit 2020 temp path changes every session

6 REPLIES 6
Reply
Message 1 of 7
n.vroegindeweij
1306 Views, 6 Replies

Revit 2020 temp path changes every session

Hello all,

 

In our add-in for Revit we are using the temp path, which can be requested using Path.GetTempPath() in C#.

When this is requested in pre 2020 version, this returned the %TMP% environment variable path.

 

Since Revit 2020 the requested temp path contains an additional guid at the end of the path, which changes after every restart of Revit(ie. C:\Users\USERNAME\AppData\Local\Temp\84ae8c0d-197b-4b44-b8d3-8823fabbba4f). It seems like Revit changes the temp path for the scope of the application.

 

Of course we can remove the guid from the path in our add-in, but I'm wondering if this has been done by purpose or could be a bug?

 

Best regards,

 

Niels

 

Revit version: 20.0.0.377 20190327_2315(x64)

6 REPLIES 6
Message 2 of 7

Dear Niels,

 

Well, it is definitely not a bug, because no intended behaviour has ever been explicitly declared for this, afaik.

 

Of course, it may still cause a problem for you, depending on your specific needs and how you make use of it.

 

I would suggest that you use the operating system TMP variable instead of the current Revit.exe temporary path, if that suits your needs better.

 

I can gladly ask the development team (a) what caused this change, (b) why and (c) whether this is intentional.

 

They may not be able or willing to provide an answer, though.

 

I'll let you know what they say as soon as I hear back from them.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 7
Anonymous
in reply to: jeremytammik

Hello all.

I also have the same problem, and want to know, what is the reason of it? Thanks.

Message 4 of 7
jeremytammik
in reply to: Anonymous

As a poet once said referring to more unfortunate circumstances:

 

Ours is not to wonder why,

Ours is but to do or die.

 

In this case, I don't know why, and I don't think it will help you or anyone else to know either.

 

The real question is how to handle the modified behaviour, isn't it?

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 7

To get the original user temp path, below method can be used. And to have similar behavior as Path.GetTempPath(), it might be good to use TEMP, USERPROFILE, WinDir as fallback variables.

 

Environment.GetEnvironmentVariable("TMP", EnvironmentVariableTarget.User);

Probably from technical point of view there is nothing wrong with the change of temp path on application level. However, I think it can cause unexpected behavior for a lot add-ins(ie caching in temp, suddenly doesn't work).

Message 6 of 7
Chuong.Ho
in reply to: n.vroegindeweij

Have any explain why Autodesk do that ?

Chuong Ho

EESignature

Message 7 of 7
jeremy_tammik
in reply to: Chuong.Ho

I'm sorry I have no explanation. I can only refer to my answer above to nikita_bokhan...

  

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community