I\'m writing a Qt application that needs to save some settings to the user\'s configuration directory.
I\'ve come up with the following code to get this folder:
Yes, this is supposed to be an easy task - but you're not supposed to hard-code paths. You should use the native APIs on win/mac, and an enviroment variable on most newer unix-like. Of course, Qt helps you do this cross-platform.
Follow Tibur's suggestion and use QSettings if it's configuration data for your Qt app. You can also get the config directory by using the appropriate QT api.
QT4: QDesktopServices::storageLocation(QDesktopServices::DataLocation)
QT5: QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)