For each OS there is a location for storing temporary data. It could be like: C:/Users/[user name]/AppData/Temp (or so). How can I get this path independently from OS with QT?
Temp files often have the extension . TMP and are stored in the C:\Users\AppData\Local\Temp folder.
In Unix and Linux, the global temporary directories are /tmp and /var/tmp. Web browsers periodically write data to the tmp directory during page views and downloads. Typically, /var/tmp is for persistent files (as it may be preserved over reboots), and /tmp is for more temporary files.
Open your File Explorer (it's usually the first button on your desktop taskbar, looks like a folder). Go to the "This PC" section on the left, and then double-click your C: drive. On the Home tab at the top, click "New Folder" and name it "Temp".
It is not possible to get the temp directory for an arbitrary user, but for the current user you can use QDir::temp()
or QDir::tempPath()
.
You want to get QDesktopServices::TempLocation
. See http://doc.trolltech.com/qtextended4.4/qdesktopservices.html#StandardLocation-enum for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With