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)
@
#include <QtCore>
#include <QDesktopServices>int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
app.setOrganizationName("ExampleOrg");
app.setOrganizationDomain("example.com.au");
app.setApplicationName("ExampleApp");
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
QStringList paths = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
#else
QString paths = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
#endif
qDebug() << qVersion() << paths;
return 0;
}
@
Outputs under different Qt versions on 64-bit Linux:
@
4.8.4 "/home/chrisw/.local/share/data/ExampleOrg/ExampleApp"
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)