Get system-wide config/data location
Is it possible to get system-wide location of the config/data directory for any user with Qt? Something like
C:\Users\AllUsers\AppDatain Windows and
/usr/local/sharein Linux etc.
I checked Qt4 docs, seems
QDesktopServicesis the right class to use, but it returns only user folder not system-wide location. In Qt5 there is a
QStandardPathsclass, which can return both user and system-wide locations. But
QStandardPaths::standardLocations(QStandardPaths::AppDataLocation)returns list of paths and I can't extract required path from this list, as there is no warranty that order of items in it always will be the same. Also from what I understand, result returned by
QStandardPaths::locate(QStandardPaths::AppDataLocation, fileName)depends on the user who runs program, e.f. for ordinal user it will return user directory like
/home/user/.local/share/someprog, for sysadmin
Any ideas how to get system-wide config/data directory in crossplatform way?