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)
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
Hello all.
I also have the same problem, and want to know, what is the reason of it? Thanks.
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?
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).
I'm sorry I have no explanation. I can only refer to my answer above to nikita_bokhan...
Can't find what you're looking for? Ask the community or share your knowledge.