Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
None
-
4.6.2
-
None
Description
QDesktopServices::storageLocation(QDesktopServices::DataLocation) return invalid path string in Linux if organizationName and/or applicationName is not set.
file: qdesktopservices_x11.cpp:
if (type == QDesktopServices::DataLocation) { QString xdgDataHome = QLatin1String(qgetenv("XDG_DATA_HOME")); if (xdgDataHome.isEmpty()) xdgDataHome = QDir::homePath() + QLatin1String("/.local/share"); xdgDataHome += QLatin1String("/data/") + QCoreApplication::organizationName() + QLatin1Char('/') + QCoreApplication::applicationName(); return xdgDataHome; }
We can see from code that if organisation name is empty there will be double '/'-chars after 'data'. If application name is missing then function will return string which end with '/'. So it doesn't behave same way with and without application name. If organisation AND application name is missing the function will return path which ends with double '/'-character.