From Qt 4.4 forward QDesktopServices provided storageLocation()
This was supposed to make cross platform good. It certainly helped. We now had a list of standard locations we could relegate to Qt.
QDesktopServices::DesktopLocation 0 Returns the user's desktop directory.
QDesktopServices::DocumentsLocation 1 Returns the user's document.
QDesktopServices::FontsLocation 2 Returns the user's fonts.
QDesktopServices::ApplicationsLocation 3 Returns the user's applications.
QDesktopServices::MusicLocation 4 Returns the users music.
QDesktopServices::MoviesLocation 5 Returns the user's movies.
QDesktopServices::PicturesLocation 6 Returns the user's pictures.
QDesktopServices::TempLocation 7 Returns the system's temporary directory.
QDesktopServices::HomeLocation 8 Returns the user's home directory.
QDesktopServices::DataLocation 9 Returns a directory location where persistent application data can be stored. QCoreApplication::applicationName and QCoreApplication::organizationName should work on all platforms.
QDesktopServices::CacheLocation 10 Returns a directory location where user-specific non-essential (cached) data should be written.
While QDir has home(), homePath(), temp(), and tempPath) I can't find in the CopperSpice documentation an equiv for DataLocation. This was very handy for identifying where to put things. We no longer had to have ugly conditionally compiled code in our base just to figure out where the OS wanted us to put a config file. We just had to have one really long line.
Code: Select all
QDir storLoc( QDesktopServices::storageLocation( QDesktopServices::DataLocation); storLoc.mkPath( QCoreApplication::applicationName()); storLoc.cd( QCoreApplication::applicationName());
Did this just get skipped or is it in some other part of the library I cannot find via searching the on-line doc?