Differences: QDesktopServices vs QStandardPaths
Can anyone tell me if the following differences between the paths returned by Qt 4.8 QDesktopServices and 5.1RC QStandardPaths are intentional or bug-worthy? (They are certainly annoying either way)
int main(int argc, char **argv)
QCoreApplication app(argc, argv);
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
QString paths = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
qDebug() << qVersion() << paths;
Outputs under different Qt versions on 64-bit Linux:
5.1.0 ("/home/chrisw/.local/share/ExampleOrg/ExampleApp", "/usr/share/ExampleOrg/ExampleApp", "/usr/local/share/ExampleOrg/ExampleApp", "/usr/share/ExampleOrg/ExampleApp")
Note the extra "data" directory in the Qt4 path.
This means my ported Qt4-based code, when built with Qt5, looks in the wrong location for data that was previously installed/generated in the DataLocation on the deployed machine.
Quite a strange case: it's not necessarily a bug, as it does return standard location. It would have been a regression, but the name of the class has changes, so technically it's a different thing ;) Funny.
Seems like a good candidate for a bug in Jira or at least a discussion on dev mailing list. The only thing is that if it's fixed now (say, the path is reverted back to the one reported by Qt4), it will cause a regression against Qt 5.0...
IMO, this is not a bug. If you want to make it compatible with Qt4, you can still use QDesktopServices::storageLocation(QDesktopServices::DataLocation)
Yes, but ultimately that deprecated function will go away and the problem remains.
You can also use QStandardPaths::writableLocation(GenericDataLocation) + "data/ExampleOrg/ExampleApp" if you never want to move the data out of there.