-1

As this question GetTempPath returns different path in different process described, the GetTempPath could be changed by a process.

Do you know a way to get the temp path for a user (which is not affected by specific application) ?

user1633272
  • 2,007
  • 5
  • 25
  • 48

1 Answers1

2

There is no user specific temp directory and there is no known folder constant for it. You could argue that %LocalAppData%\Temp is the default but you should not assume that this is true.

A user might set their %Temp% to a different drive (RAM disk etc.) and apply it to all processes or they might run a specific application with a different %Temp% because their normal %Temp% location does not have enough free space etc.

The GetTempPath function already has other backup locations it tries if %Temp% is invalid so there is no reason for you to second-guess it. If you need a per-user folder that is shared by multiple processes then you should use a folder under FOLDERID_LocalAppData.

Anders
  • 97,548
  • 12
  • 110
  • 164