- My C++ program produce some logs and data (text/3D files/etc),
- My program should not be specific to an OS (Posix and Windows),
- The data can be lost on program/machine restart (when the program starts, it cleans this folder anyway).
I found many thread on where to place the application data and how to get this folder from code, but they are all platform specific.
Some examples:
Linux: /var/log/your_app /home/user/.your_app/logs /var/lib/your_app
Windows: %ProgramData%\your_app %LOCALAPPDATA%\your_app
At first, I wanted to store this data in the program folder (where the executable is stored) using relative path, but the program does not have write privileges in his own folder.
The only not OS specified solution that I've found is to use
std::filesystem::temp_directory_path.
However this folder look like a mess (at least on Windows) with dozens of temp files/folders generated by other process.
I'm not sure it's the best thing to send a user in this jungle.

Question
- Is it a good solution to use the TEMP folder to store Application Data/Logs ?
- If not, how would you do in C++ to get the best directory where to store Data/Logs for an application, regardless of the OS ?