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) ?
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) ?
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
.