How do I get the standard system / user paths in Qt?
What I really need is to get the location of the user's Downloads folder.
In Qt 4, there is QDesktopServices providing some user paths:
https://doc.qt.io/qt-4.8/qdesktopservices.html#StandardLocation-enum
It has e.g. Desktop and Documents but no specific Downloads folder.
In Qt 5, use QStandardPaths:
const QString downloadsFolder = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
You can use QDir::homePath()
to get a QString
to the home directory of the current user's profile but I'm not sure that there is a "standard" download directory identified by the OS.
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